relativelayout设置边框_如何在android relativelayout周围放置边框?
I've seen thissubject about puting a border around an android textview, and I used it. But now, I would like to put a border around widgets which are situated into a relative layout. How can I do it..
I've seen this subject about puting a border around an android textview, and I used it. But now, I would like to put a border around widgets which are situated into a relative layout. How can I do it?
解决方案in your res/drawable folder, create a new file background_border.xml
In this file, you will define the background for widget like this:
android:shape="rectangle" >
android:color="@color/color_stroke"/>
android:topLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topRightRadius="0dp" />
android:endColor="@android:color/transparent"
android:angle="90"/>
set the background of your widget to the drawable configuration you've just created
eg. if you want to put your border on a relativelayout:
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_border"
android:padding="15dp">
...
更多推荐
所有评论(0)