我想爲Android EditText小部件提供透明背景。這怎麼可能?Android EditText透明背景
回答
試試這個
android:background="@null"
使用半透明的主題
<activity android:theme="@android:style/Theme.Translucent">
在這裏查看更多http://developer.android.com/guide/topics/ui/themes.html – yogsma 2011-04-19 06:25:57
android:background="@android:color/transparent"
我想在佈局文件中做到這一點。有可能的? – 2013-02-27 10:44:55
您還可以設置它使用Java代碼
myTextView.setBackgroundColor(Color.TRANSPARENT);
很簡單:
android:alpha="0.5"
用alpha來玩這不是個好主意 - 這是非常(!!!)糟糕的渲染性能的一個非常常見的來源。 – dominus 2015-06-22 12:06:25
將這個屬性中的EditText:
android:background="@null"
android:background="#00000000"
你也可以做到這一點programitically這樣的:
TypedValue value= new TypedValue();
getApplicationContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, value, true);
myButton.setBackgroundResource(value.resourceId);
的EditText,像任何其他視圖/組件可以在自定義xml文件。 您只需要在EditText屬性中包含以下屬性。
android:background="@null"
-
xml文件中
- 使用此屬性 機器人:背景= 「@安卓:彩色/透明」
- ,並在onCreate方法使用 edittext.setBackgroundColor的java文件運行時(Color.TRANSPARENT );
這集佈局將工作
android:background="@color/transparent
和colors.xml
<color name="transparent">#00000000</color>
- 1. EditText背景顏色不透明android
- 2. Android GLSurfaceView無背景透明背景ZOrderonTop
- 3. Android OpenGL ES透明背景
- 4. 透明背景
- 5. html透明背景
- 6. 與透明背景
- 7. Iframe透明背景
- 8. webview透明背景
- 9. NSTableCellView透明背景
- 10. UIToolBar背景透明
- 11. Pygame透明背景
- 12. AS3透明背景
- 13. JOGL透明背景
- 14. PHP:透明背景
- 15. Div背景透明
- 16. 透明JFrame背景
- 17. AChartEngine透明背景
- 18. UWP:MapControl透明背景
- 19. 與透明背景
- 20. Recyclerview透明背景
- 21. 透明.png背景
- 22. Imageview背景透明
- 23. 背景不透明
- 24. UIView背景透明
- 25. WPF透明背景
- 26. Fotorama透明背景
- 27. TTStyledTextLabel透明背景
- 28. AQGridViewCell透明背景
- 29. AchartEngine背景透明
- 30. phpqrcode透明背景
我想這樣做的佈局文件添加此。有可能的? – 2013-02-27 10:43:11
@DhawalSodhaParmar是的。這是在佈局 – Nabin 2015-03-27 03:51:40
完成謝謝,這工作。 – 2015-08-25 10:32:48