Adi*_*ain 2 android android-layout android-activity

我有一个活动A,它有一个"向下"按钮(见上图).当我按下此按钮时,我想在活动A的顶部启动活动B,因此底部的一些活动A仍然可见.活动B可以反过来启动一些其他活动(C,D等)但是它们只显示在与B相同的屏幕区域内.任何人都知道这是否可能以及我如何能够实现它?
编辑:我知道我可以添加
android:theme="@android:style/Theme.Dialog"到我的活动清单,但据我所知,这显示在屏幕的中央,而不是我可以调整我喜欢的大小.如果我错了,请纠正我......
这是应该在活动a之上的活动的xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0"
android:layout_weight="0.6"
android:background="#000000" >
//use this for your new activity contents
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0"
android:layout_weight="0.4"
android:background="#00000000" >
//this is empty
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
现在在活动B,C,......等的清单中:
<activity
android:label="@string/app_name"
android:name=".ActivityB"
android:theme="@style/Theme.Transparent"
android:screenOrientation="portrait" >
Run Code Online (Sandbox Code Playgroud)
在values/styles.xml中:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Transparent" parent="android:Theme.NoTitleBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@drawable/theme_transparent</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
最后在drawable/theme_transparent.xml中:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#00000000" ></solid>
</shape>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4472 次 |
| 最近记录: |