Применение закругленных углов к внутреннему элементу CardView - PullRequest
0 голосов
/ 30 ноября 2018

У меня есть CardView с внутренней компоновкой, у которой цвет фона отличается от CardView.Я хочу, чтобы внутренняя компоновка была выровнена по одной стороне CardView и взять 2 закругленных угла этой стороны.

enter image description here

 <android.support.v7.widget.CardView
            android:layout_alignParentBottom="true"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginBottom="@dimen/activity_horizontal_margin"
            android:layout_marginRight="30dp"
            app:cardCornerRadius="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp"
                    android:text="Pediatric Drugs"/>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:padding="10dp"
                    android:background="@color/colorPrimary"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="HELLO"
                        android:textColor="@color/white"
                        android:textStyle="bold"
                        />
                </LinearLayout>

            </RelativeLayout>
        </android.support.v7.widget.CardView>

1 Ответ

0 голосов
/ 30 ноября 2018

Я решил проблему, установив пользовательский фон для внутреннего макета со значениями верхнего и нижнего радиуса, такими же, как значение радиуса CardView.

...