如何将角半径应用于 LinearLayout [英] How to Apply Corner Radius to LinearLayout
本文介绍了如何将角半径应用于 LinearLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想制作一个带有圆形边框的布局.如何在 LinearLayout
中应用特定大小的半径?
I want to make a layout with a rounded border. How can I apply a radius of a particular size in a LinearLayout
?
推荐答案
您可以在 drawable 文件夹中创建一个 XML 文件.调用它,例如,shape.xml
You can create an XML file in the drawable folder. Call it, for example, shape.xml
在shape.xml
中:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#888888" >
</solid>
<stroke
android:width="2dp"
android:color="#C4CDE0" >
</stroke>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" >
</padding>
<corners
android:radius="11dp" >
</corners>
</shape>
标签用于您的特定问题.
The <corner>
tag is for your specific question.
根据需要进行更改.
在你的whatever_layout_name.xml
中:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="5dp"
android:background="@drawable/shape" >
</LinearLayout>
这就是我通常在我的应用程序中所做的.希望这会有所帮助....
This is what I usually do in my apps. Hope this helps....
这篇关于如何将角半径应用于 LinearLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文