1

Androidで左上と右下にコーナー半径を作成する方法は? このような

アディ

私のコードは


<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="@drawable/bg_layout">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerInParent="true"
                android:layout_margin="@dimen/twenty_sp"
                android:text="@string/sign_in"
                android:textColor="@color/colorWhite"
                android:textSize="@dimen/thirty_sp" />
        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_layout_white"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="@dimen/ten_sp"
                    android:orientation="vertical"
                    android:padding="@dimen/ten_sp">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="left"
                        android:text="@string/phone_number"
                        android:textColor="@color/colorBlack" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/five_sp"
                        android:orientation="horizontal">

                        <Spinner
                            android:id="@+id/main_spinner_coutry"
                            android:layout_width="wrap_content"
                            android:layout_height="@dimen/fifty_sp"
                            android:entries="@array/country_code"
                            android:prompt="@array/country_code"
                            android:spinnerMode="dropdown" />

                        <AutoCompleteTextView
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/fifty_sp"
                            android:background="@drawable/bg_edt"
                            android:digits="0123456789"
                            android:ems="10"
                            android:hint="@string/_9876543210"
                            android:imeOptions="actionGo"
                            android:inputType="phone"
                            android:maxLength="10" />
                    </LinearLayout>

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="@dimen/ten_sp"
                    android:orientation="vertical"
                    android:padding="@dimen/ten_sp">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="left"
                        android:text="@string/password"
                        android:textColor="@color/colorBlack" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/fifty_sp"
                        android:layout_margin="@dimen/five_sp"
                        android:background="@drawable/bg_edt"
                        android:hint="@string/_9876543210"
                        android:inputType="textPassword" />

                </LinearLayout>


            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/ten_sp"
                android:orientation="vertical"
                android:padding="@dimen/ten_sp">

                <Button
                    android:id="@+id/main_btn_signin"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/bg_btn"
                    android:padding="@dimen/ten_sp"
                    android:text="@string/sign_in"
                    android:textAllCaps="false"
                    android:textColor="@color/colorWhite"
                    android:layout_margin="@dimen/ten_sp"/>

                <TextView
                    android:layout_margin="@dimen/ten_sp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:padding="@dimen/ten_sp"
                    android:text="@string/forgot_password"
                    android:textColor="@color/colorAccent" />

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</ScrollView>

背景のドローアブルは

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle">
    <solid android:color="@color/colorWhite" />
    <corners
        android:topRightRadius="30dp"
         />

</shape>

コードの左上隅と右下隅を図のように表示したいのですが、背景色のある角が1つしか表示されません。上の図のように作成しようとしましたが、うまくいきません...

4

4 に答える 4