-9
A
回答
2
試試這個XML版圖形狀:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#ffffff" />
<stroke android:color="#80000000"
android:width="0.5dp"
/>
<corners
android:bottomLeftRadius="32dp"
android:topLeftRadius="32dp" />
</shape>
2
首先儘量展現你的進步或你到目前爲止所嘗試過的以及你卡在哪裏。
其次你的問題,使用下面的代碼:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="10dp"
android:top="10dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/black" /> //change your desired color
//use can set your desired size to make curve
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="10dp"
android:topRightRadius="0dp" />
</shape>
</item>
創建此繪製,並在XML
+0
感謝您的代碼 –
0
使用如果你想只剩兩個角彎曲。然後,只需設置bottomRightRadius
& topRightRadius
到0dp
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_Transport_Grey" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="10dp"
android:topRightRadius="0dp" />
<padding
android:left="0dip"
android:right="0dip" />
</shape>
0
你的形狀(fab.xml):
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/main_light_extreme">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@color/main_light_extreme" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@color/main_normal" />
</shape>
</item>
</ripple>
您與形狀背景圖片(ImageButton的):
<ImageButton
android:id="@+id/fab"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="54dp"
android:layout_marginEnd="36dp"
android:background="@drawable/fab"
android:src="@android:drawable/ic_menu_camera" <!-- your need this -->
android:elevation="12dp" />
結果(注:紋波只能Android的API> = 21棒棒堂):
圖片上面繪製形狀:d
相關問題
- 1. 在Android中使用XML形狀設置繪製矩形
- 2. 如何在android xml中繪製三角形形狀
- 3. Android xml形狀drawable - 如何繪製u形式?
- 4. 可繪製XML疊加形狀
- 5. Android:繪製歪斜的角落形狀
- 6. Android的繪製形狀編程位圖
- 7. Android形狀繪製xml沒有繪製在設備上也沒有模擬器
- 8. Android,Java,繪製圓弧形狀的特定形狀
- 9. 形狀可繪製
- 10. 在android中使用XML繪製自定義形狀
- 11. 如何在Android中使用xml繪製此形狀?
- 12. Android將XML形狀設置爲可編程繪製
- 13. 在android中繪製填充形狀mapview
- 14. Android:使用形狀繪製「X」
- 15. Android:繪製自定義形狀
- 16. Android更改形狀可繪製顏色
- 17. 如何使用cocos2d-android繪製形狀
- 18. Android可繪製疊加形狀
- 19. 如何在Android中繪製形狀
- 20. 繪製形狀與JavaScript - 形狀問題
- 21. Android:在另一個形狀內繪製形狀
- 22. 繪製圖像的形狀
- 23. Actionscript中的繪製形狀
- 24. Android - 在xml中繪製正方形
- 25. Android:三角形作爲XML可繪製
- 26. 形狀XML可繪製不能被解析成位圖XML可繪製
- 27. 繪製多邊形形狀的紋理
- 28. Matplotlib繪製圖形上的形狀
- 29. Android可繪製形狀:將矩形變爲方形
- 30. 點擊JPanel繪製形狀
嘗試後,你已經完成的工作是什麼,什麼問題你正面臨着。 – gprathour
http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-with-rounded-corners檢查它 –