【问题标题】:how to create android linearlayout cornar crap color?如何创建android线性布局cornar废话颜色?
【发布时间】:2021-10-31 20:23:38
【问题描述】:

我是新的安卓开发者..

我想做 android linearlayoutcornar 废话颜色。我试过了。我没有得到我看到的角落抢断。下面是我的丝绸给我的线性布局。

线性布局

<LinearLayout
    android:orientation="horizontal"

    android:background="@color/gnt_ad_green"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

    android:weightSum="4.0">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0"
        android:text="Intergiration"
        android:drawableLeft="@drawable/ic_filter"
        android:drawablePadding="10.0dip"
        android:gravity="center|left"
        android:padding="15.0dip"
        android:textColor="@color/colorWhite"
        android:textSize="16.0sp" />

    <LinearLayout
        android:background="@color/colorBackgroundLight"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3.0">
        <TextView android:textSize="12.0sp"
            android:textColor="@color/colorPrimary"
            android:gravity="center"
            android:text="sdfsdf gd"

            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>
</LinearLayout>

我想要这样的设计 simple image

【问题讨论】:

    标签: android layout colors android-linearlayout


    【解决方案1】:

    你可以试试这个

    rect_background.xml

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item>
            <shape android:shape="rectangle" >
                <solid android:color="#F00" />
            </shape>
        </item>
        <item>
            <rotate
                android:fromDegrees="110"
                android:pivotX="90%"
                android:pivotY="90%"
                >
                <shape android:shape="rectangle" >
                    <solid android:color="#FFF" />
                </shape>
            </rotate>
        </item>
    
    </layer-list>
    

    layout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <View
            android:layout_width="200dp"
            android:layout_height="50dp"
            android:background="@drawable/rect_background"/>
    
    </LinearLayout>
    

    【讨论】:

      【解决方案2】:

      也许您必须为此使用图像(添加包含这样形状的图像)并将此图像设置为线性布局的背景。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-11-01
        • 1970-01-01
        • 2018-09-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-12-22
        相关资源
        最近更新 更多