我想制作一个带有圆形边框的布局。如何在 LinearLayout
中应用特定大小的半径?
最佳答案
您可以在 drawable 文件夹中创建 XML 文件。调用它,例如,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>
<corner>
标签是针对您的特定问题的。
根据需要进行更改。
在你的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>
这是我通常在我的应用程序中做的事情。
关于android - 如何将角半径应用于线性布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10074249/