如何在 Android TextView 中制作边缘的形状,以便结果如下图所示?
问问题
1934 次
2 回答
1
不需要像这样制作任何复杂的形状。image
看起来像这样就足够了(即标签的背景)。或者你可以用白色轮廓制作“蓝点”,这样最终你会在视觉上得到如图所示的结果。
于 2013-07-05T11:41:51.937 回答
1
Just create a file with the name of rounded_corners.xml in the /res/drawable folder.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle">
<solid android:color="#d8d8d8" />
<corners android:radius="7dp" />
</shape>
</item>
<!-- White Top color -->
<item android:bottom="3px">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners android:radius="7dp" />
</shape>
</item>
</layer-list>
and specify this in the textbox as the background drawable
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corners"
/>
hope this helps!
于 2013-07-05T11:46:03.657 回答