我想有半透明方面的活动(2)在另一个活动(1),在屏幕的顶部对齐(4)。
我已经试过:把这些主题活动的人数2:
<样式名称=Theme.CustomDialog父=机器人:款式/ Theme.Dialog>
<项目名称=机器人:windowBackground> @android:彩色/黑白LT; /项目>
< /风格>
<样式名称=CustomTheme>
<项目名称=机器人:windowBackground> @android:彩色/透明< /项目>
<项目名称=机器人:背景> @android:彩色/透明< /项目>
<项目名称=机器人:windowIsFloating>真< /项目>
<项目名称=机器人:windowNoTitle>真< /项目>
< /风格>
但结果始终是3。
如果我设置<项目名称=机器人:windowIsFloating>假< /项目>
在 CustomTheme
结果是2。
谁能告诉我怎样才能得到4?谢谢!
更新:这是我的活动2的布局:
< XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直机器人:后台=#0000>
< RelativeLayout的
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT机器人:后台=#FFFFFF>
<按钮
机器人:ID =@ + ID /按钮1
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=菜单的Android版本:layout_centerHorizontal =真/>
< / RelativeLayout的>
< / RelativeLayout的>
解决方案
最后,这个主题努力得到的结果类似的图像数量4:
<样式名称=Theme.CustomTranslucent父=机器人:款式/ Theme.Translucent>
<项目名称=机器人:backgroundDimEnabled>真< /项目>
<项目名称=机器人:backgroundDimAmount> 0.5 LT; /项目>
<项目名称=机器人:windowAnimationStyle> @android:款式/ Animation.Dialog< /项目>
<项目名称=机器人:背景> @android:彩色/透明< /项目>
< /风格>
在我的活动2的布局,我可以eihter设置安卓背景=@机器人:彩色/透明
或没有设置任何值,使其工作。
由于MikeIsrael和德维尔他们的帮助。
I'd like to have an activity (2) with translucent aspect over another activity (1), aligned at the top of the screen (4).
I have tried assigning these themes to activity number 2:
<style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/black</item>
</style>
<style name="CustomTheme">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
</style>
But the result is always 3.
If I set <item name="android:windowIsFloating">false</item>
in the CustomTheme
the result is 2.
Can anybody tell me how can I get 4? Thanks!
UPDATE: This is my activity 2 layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:background="#0000">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#FFFFFF">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Menu" android:layout_centerHorizontal="true"/>
</RelativeLayout>
</RelativeLayout>
解决方案
Finally, this theme worked to get a result like image number 4:
<style name="Theme.CustomTranslucent" parent="android:style/Theme.Translucent">
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:background">@android:color/transparent</item>
</style>
In my activity 2 layout, I could eihter set android:background="@android:color/transparent"
or not set any value at all to make it work.
Thanks to MikeIsrael and Veer for their help.