I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView
and EditText
would also be helpful.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I think, this is you exactly needed.
Here drawable(xml) file that creates rounded rectangle. round_rect_shape.xml
Here layout file: my_layout.xml
-> In the above code, LinearLayout having the background(That is the key role to place to create rounded rectangle). So you can place any view like TextView, EditText... in that LinearLayout to see background as round rectangle for all.
In
monodroid
, you can do like this for rounded rectangle, and then keeping this as a parent class,editbox
and other layout features can be added.Now, in which element you want to use this shape just add:
android:background="@drawable/custom_round_ui_shape"
Create a new XML in drawable named "custom_round_ui_shape"
If you want to use the rounded rectangle as a background for the TextView and EditText you should use custom background. You need to use the shape component for this for more info read this question Using shape drawable as my background xml
In your layout xml do the following:
By changing the android:radius you can change the amount of "rounding" of the corners.