-4
A
回答
1
drawable_line.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="@android:color/black"
android:centerColor="@android:color/white
android:endColor= "@android:color/black"
android:angle="360"
/>
</shape>
在佈局中添加它作爲view
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:background="@drawable/drawable_line" />
+0
是的,這工作正常。 –
0
在activity_main添加這些:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:gravity="center"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="80dp">
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/line" />
</LinearLayout>
</LinearLayout>
,並創建繪製RES文件:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="360"
android:centerColor="@android:color/white"
android:endColor="@android:color/black"
android:startColor="@android:color/black" />
</shape>
相關問題
- 1. 形狀圖像
- 2. 如何在android中像下面的圖像設計XML?
- 3. 更改圖像形狀的圖像
- 4. Android自定義圖像視圖形狀
- 5. 繪製圖像的形狀
- 6. android 2.1 xml drawables中的錯誤?在下面的圖像
- 7. 比較圖像(形狀sihlohette圖像)
- 8. 在android中更改圖像形狀
- 9. 鑽石形狀的三角形圖像
- 10. 如何在Android中裁剪橢圓形或面部形狀的圖像?
- 11. 裁剪形狀的方形圖像Android在應用程序
- 12. 從android中的位圖圖像識別對象的形狀?
- 13. Tensorflow圖像形狀錯誤
- 14. 設計佈局像下面的圖像按鈕圖像中的Android
- 15. 在不改變圖像內部形狀的情況下調整圖像大小
- 16. 在android中切割拼圖形狀的圖像
- 17. Android的XML形狀繪製
- 18. 線圖像的PHP下面
- 19. textview下面的圖像linearlayout
- 20. 圖像中的形狀識別
- 21. 剪輯特定形狀的圖像.NET
- 22. 高效檢測大圖像的形狀
- 23. 查找圖像中的封閉形狀
- 24. 畫成畫布形狀的圖像
- 25. 創建形狀或圖像的筆劃
- 26. 保存的PointF []形狀圖像
- 27. Javascript圖像裁剪不同的形狀
- 28. 查找圖像中的特定形狀
- 29. 帶形狀css的疊加圖像
- 30. 圖像中的PHP形狀識別
[http://meta.stackoverflow.com/questions/266384/is-it-ok-to-downvote-questions-asking-about-how-to-achieve-something-without-ha](http ://meta.stackoverflow.com/questions/266384/is-it-ok-to-downvote-questions-asking-about-how-to-achieve-something-without-ha) –