2011-12-28 61 views
0

我用下面的主题在我的活动:的Android的EditText透明主题

<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> 

没关系解决它使用此:

<style name="Theme.TranslucentDarkGrey" parent="android:Theme.Translucent"> 
    <item name="android:windowBackground">@color/translucent_dark_grey</item> 
</style> 
+0

检查这个问题,也可能是您的帮助:安卓的EditText透明背景](http://stackoverflow.com/questions/5737878/android-edittext-transparent-background) – 2011-12-28 09:59:56

回答

1

没关系解决它使用此:

<style name="Theme.TranslucentDarkGrey" parent="android:Theme.Translucent"> 
<item name="android:windowBackground">@color/translucent_dark_grey</item> 

0

应用下面的代码行的编辑框,它会给你透明背景。

android:background="@null" 
+0

这只是让EditText完全透明,并且与背景混合的浮动文字显得杂乱无章。 – Maurice 2011-12-28 10:07:59

+0

你可以定义部分透明吗?根据您的查询,您正在寻找透明背部,我认为我是正确的每个问题。 – RobinHood 2011-12-28 11:30:52