简体   繁体   English

如何曲线布置角?

[英]how to curve layout corner?

this is my nested layout how do i change its corner to curve?? 这是我的嵌套布局,如何将其角更改为曲线? image url 1 is a sample i want to do curve like that which implement inblack berry image url 2 is my android code how do i curve layout like that?? 图像URL 1是一个我想做曲线的示例,它实现了inblack berry图像URL 2是我的android代码,我该如何弯曲布局? url1 is http://imgur.com/dFUVF url 2 is http://imgur.com/UMffI url1是http://imgur.com/dFUVF url 2是http://imgur.com/UMffI

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="500dp"

    android:background="#D3D3D3"
    android:orientation="vertical"
    android:paddingLeft="3dip"
    android:paddingRight="3dip"
    >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="120dp"

        android:background="#333333"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/btnMiniStatement"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button1"
            android:onClick="onClickFeature"
            android:text="MINI STATEMENT" />

        <Button
            android:id="@+id/btnBalanceInquiry"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button2"
            android:onClick="onClickFeature"
            android:text="Balance Inquiry" />

        <Button
            android:id="@+id/btnUtilityBalanceInquiry"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button3"
            android:onClick="onClickFeature"
            android:text="Utility Balance Inquiry" />
    </LinearLayout>

In res/drawable create a new file (curved_bg.xml for example). res/drawable创建一个新文件(例如,curved_bg.xml)。 In that file put: 在该文件中:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <solid android:color="#333333" />

    <corners android:radius="5dp" />

    <stroke
        android:width="1dp"
        android:color="#ffffff" />

</shape>

In your layout file set this as the background on your inner LinearLayout 在布局文件中,将其设置为内部LinearLayout的背景

android:background="@drawable/curved_bg"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM