【发布时间】:2014-03-18 17:56:36
【问题描述】:
我想让我的第二个布局填满整个屏幕并覆盖所有第一个布局,但它只是像大弹出窗口一样一直显示,有什么解决方案吗?
这是我当前显示的布局的描述:
|====================|
|first layout |
| |==============| |
| | | |
| |second layout | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| |==============| |
| |
|====================|
我需要的是这样的:
|====================|
|second layout |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|====================|
这是我的第一个布局 xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="60dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btnRenungan"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Renungan" />
<Button
android:id="@+id/btnGambar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="Gambar" />
<Button
android:id="@+id/btnLokasi"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Lokasi" />
</LinearLayout>
<LinearLayout android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_marginBottom="58px"
android:layout_height="45px" android:layout_width="200px"
android:id="@+id/lin_progress_bar" android:visibility="invisible">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/frameLayout1"
android:layout_alignParentBottom="true" />
<TextView android:id="@+id/TextView01" android:layout_height="fill_parent"
android:layout_width="fill_parent" android:gravity="center_vertical"
android:textStyle="bold" android:text="Loading..."
android:layout_marginLeft="10px" android:textSize="23px"
android:textColor="#808080"></TextView>
</LinearLayout>
</FrameLayout>
</RelativeLayout>
这是我的第二个布局 xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<ListView
android:id="@+id/listRenungan"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:layout_weight="2"/>
<ImageButton
android:id="@+id/btnBack"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/button_back"
android:drawable="@drawable/button_back"
android:scaleType="fitXY" />
</LinearLayout>
这是我调用第二个布局的代码:
case R.id.btnRenungan:
//Activity Renungan
Intent intentSelectionRenungan=new Intent(this, selectionRenungan.class);
startActivity(intentSelectionRenungan);
【问题讨论】:
-
你想像对话框一样显示第二个布局
-
嗨!小澄清:您说的是两种不同的活动,对吧?
-
如果你在谈论活动,你的清单中可能会有这行:
android:theme="@android:style/Theme.Dialog"。如果有,请删除它。 -
是的,有两种不同的活动
-
是的,麦克工作得很好。谢谢