小编Uur*_*Ysr的帖子

如何将包含的xml布局更改为java代码上的另一个布局?

我有个问题.我开发android应用程序.

我将第二个布局包含在第一个布局中:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:layout_gravity="clip_horizontal"
    android:layout_alignParentLeft="true" 
    android:id="@+id/rlMenu"
    >

    <Button
        android:id="@+id/bMusteriler"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Musteriler"
        android:textSize="45dp"
        android:layout_alignParentLeft="true"
         />

</RelativeLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_toRightOf="@id/rlEkranlar"
     >

    <include
        android:id="@+id/include1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        layout="@layout/ikinci" />

</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

问题是如何在单击按钮(在java代码上)时更改包含的布局?

对不起我的英语不好.谢谢.

android android-layout xml-layout

25
推荐指数
2
解决办法
4万
查看次数

标签 统计

android ×1

android-layout ×1

xml-layout ×1