【发布时间】:2012-01-25 06:26:36
【问题描述】:
我在第一个布局中加入了第二个布局,如下所示:
<?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>
问题是如何在单击按钮时更改包含的布局(在 java 代码上)?
【问题讨论】:
-
创建一个新的 xml 文件和活动,并通过意图调用第二个。
-
请修改你的问题,不太清楚。
-
@YugandharBabu 我想在单击按钮时将 layout="@layout/ikinci" 更改为 layout="@layout/third_layout"。
标签: android android-layout xml-layout