如何申请圆角半径为的LinearLayout [英] How to Apply Corner Radius to LinearLayout

查看:123
本文介绍了如何申请圆角半径为的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?

推荐答案

您可以创建在绘制文件夹中的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>

&LT;拐角GT; 标记为您的具体问题

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆