3
A
回答
16
試試這個
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ur_image" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_bg" >
</FrameLayout>
和gradient_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="90"
android:centerColor="#59000000"
android:endColor="@android:color/transparent"
android:startColor="#000000" />
</shape>
3
將使用的FrameLayout圖像上方的另一個ImageView的並將其設置爲源:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:startColor="#8000"
android:endColor="#0000"/>
</shape>
1
這可以通過創建gradients.check this
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="#4C4C43"
android:endColor="#B8B894"
android:angle="270" />
</shape>
</item>
</selector
>
可以使用
0
您可以使用alpha屬性
android:alpha="0.0" thats invisible
android:alpha="0.5" see-through
android:alpha="1.0" full visible
相關問題
- 1. Objective-C - 如何在圖像中放置黑色透明
- 2. 在白色和黑色的圖像上使用透明,使透明度倒置
- 3. Android透明黑色圖層?
- 4. 在Android中放置半透明圖像
- 5. 在透明圖像上放置透明圖像
- 6. 如何在CSS中的圖像上放置不透明的白色漸變?
- 7. 使黑色像素透明
- 8. jcrop變成透明圖像黑色
- 9. 透明圖像在緩存位圖上顯示爲黑色
- 10. 將圖像放在另一個使黑色部件透明的位置
- 11. 圖像上的黑色透明覆蓋圖
- 12. 爲什麼透明像素在圖像中顯示爲黑色?
- 13. Android TV:未聚焦的圖像包含黑色透明背景?
- 14. Android的透明圖像獲得純黑色化背景
- 15. 如何在img上放置文本,並使圖像透明
- 16. 如何在圖像上放置透明按鈕?
- 17. 如何讓背景圖像的黑色部分透明?
- 18. 如何通過Android上的透明圖像顯示顏色?
- 19. 將透明圖像放置到另一個不透明圖像
- 20. 透明PNG黑色
- 21. 在背景圖像上放置透明圖像
- 22. 在ImageView中的不透明圖像上的透明圖像
- 23. 85%不透明度的Android黑色
- 24. OpenGL透明圖像在其中有黑色
- 25. 如何將帶有透明背景的白色徽標圖像放在黑色標題中?
- 26. 像素每像素圖像,透明變成黑色
- 27. 黑色背景上的NSColor透明度?
- 28. Three.js材質上的「黑色」透明度
- 29. 構建輪流部分透明的圖像像素黑色
- 30. 包含Texture Packer的透明像素圖像爲黑色
節約了大量hours..thanks的@shijil – CrazyMind 2016-09-26 10:30:33
這救了我的命。謝謝 :) – Grcn 2017-09-19 03:59:04