0
Q
如何覆蓋圖像
A
回答
1
你可以用小工具簡單地做到這一點:
FrameLayout是在另一個之上疊加視圖中的通用機制:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image"/>
<View
android:id="@+id/overlay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
然後在Java代碼中,你可以動態設置的透明度您覆蓋:
View overlay = (View) findViewById(R.id.overlay);
int opacity = 200; // from 0 to 255
overlay.setBackgroundColor(opacity * 0x1000000); // black with a variable alpha
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, 100);
params.gravity = Gravity.BOTTOM;
overlay.setLayoutParams(params);
overlay.invalidate(); // update the view
+0
嗯嗯................. – NEXTGENINTL
+0
這不是我想要它的方式 – NEXTGENINTL
相關問題
- 1. 如何覆蓋圖像
- 2. 覆蓋圖像
- 3. 如何覆蓋圖庫中的圖像
- 4. XSLFO覆蓋圖像
- 5. Android圖像覆蓋
- 6. 圖像被覆蓋
- 7. 如何使用bootstap覆蓋圖像
- 8. 如何覆蓋opencv Mat的子圖像?
- 9. 如何用覆蓋圖像創建ImageButton?
- 10. 如何用圖像覆蓋該線?
- 11. 你如何覆蓋圖像元數據?
- 12. 如何繪製/覆蓋圖像文件到位圖圖像?
- 13. 如何使圖像內容覆蓋圖顯示在圖像上?
- 14. 如何在DirectX(2D)中正確地覆蓋圖元覆蓋圖像
- 15. javascript中的圖像覆蓋圖像
- 16. 液體圖像覆蓋圖像
- 17. 用圖像覆蓋MKMapView
- 18. 覆蓋多個圖像
- 19. 圖像覆蓋(alt代碼)
- 20. 跨度覆蓋圖像
- 21. 覆蓋邊框圖像
- 22. Windows手機圖像覆蓋
- 23. 背景圖像覆蓋JComponents
- 24. 懸停時圖像覆蓋?
- 25. 覆蓋名稱的圖像
- 26. 覆蓋圖像與文字
- 27. css圖像蒙版覆蓋
- 28. 用CImg覆蓋圖像
- 29. 背景圖像覆蓋css
- 30. UITableView覆蓋/隱藏圖像?
如果您的覆蓋圖是一個視圖,您可以簡單地覆蓋onDraw()並繪製位圖。 – Shashika
http://stackoverflow.com/a/12548585/1168654 –