我在我的活动中使用了以下主题:
<style name="Theme.TranslucentDarkGrey" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/translucent_dark_grey</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
这给了我一个半透明的灰色背景来查看背部活动,我面临的问题是我有一个不会填充父级的EditText。如果我删除上面的主题,它填写得很好。这是布局:
<?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:orientation="vertical" >
<EditText
android:id="@+id/body"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" android:layout_weight="1"/>
</LinearLayout>
Nevermind使用它来解决它:
<style name="Theme.TranslucentDarkGrey" parent="android:Theme.Translucent">
<item name="android:windowBackground">@color/translucent_dark_grey</item>
</style>
答案 0 :(得分:1)
Nevermind使用它来解决它:
<style name="Theme.TranslucentDarkGrey" parent="android:Theme.Translucent">
<item name="android:windowBackground">@color/translucent_dark_grey</item>
答案 1 :(得分:0)
在您的编辑框中应用以下代码行,它将为您提供透明背景。
android:background="@null"