Как установить угловой радиус для карточек с некоторыми дочерними элементами?

1-е изображение - мой результат, и я хочу, чтобы оно выглядело как 2-е. Я попытался сделать так, чтобы задать радиус угла, но он не появился на экране. Я не знаю, в чем проблема, а также высота не отображается в родительской карточке.

Заранее спасибо.

введите здесь описание изображения

введите здесь описание изображения

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    tools:context="com.software_solutions.optimus_tech_project201709.CourseSelect.CourseSelectionActivity">

    <Button
        android:id="@+id/register"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="Register" />


    <Button
        android:id="@+id/you"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="you" />

    <ImageView
        android:id="@+id/dialogImageView"
        android:layout_width="match_parent"
        android:layout_height="220dp"
        android:scaleType="fitXY"
        android:src="@drawable/dialog"
        android:text="Hello" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/dialogImageView"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="-180dp"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@drawable/select_course" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:text="SELECT A COURSE"
            android:textColor="#ffffff"
            android:textSize="25dp"
            android:textStyle="bold" />
    </LinearLayout>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="OK" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/dialogImageView"
        android:orientation="vertical"
        android:weightSum="2">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerViewSelectCourse"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:padding="5dp" />


        <android.support.v7.widget.CardView
            android:id="@+id/cardViewDemo1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:layout_weight="1"
            android:elevation="3dp"
            app:cardCornerRadius="10dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#e4a455"
                android:orientation="vertical"
                android:padding="10dp"
                android:weightSum="3">

                <android.support.v7.widget.CardView
                    android:id="@+id/cardViewDemo2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    app:cardCornerRadius="10dp">

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:scaleType="fitXY"
                        android:src="@drawable/demo_one" />

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

                <android.support.v7.widget.CardView
                    android:id="@+id/cardViewDemo3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@id/cardViewDemo2"
                    android:layout_marginTop="5dp"
                    android:layout_weight="2"
                    app:cardCornerRadius="10dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#e9cca8">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:text="DEMOVIDEOONE"
                            android:textColor="#fff"
                            android:textSize="15sp"
                            android:textStyle="bold" />

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


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

    </LinearLayout>

</RelativeLayout>

person Community    schedule 02.07.2017    source источник


Ответы (1)


Добавьте app:cardBackgroundColor="#e9cca8" app:cardBackgroundColor="#e4a455" и удалите фон из ваших дочерних RelativeLayout и LinearLayout

У вас есть 3 CardView, в 3-м CardView у вас есть только ImageView, поэтому лучше вместо использования CardView вы можете использовать представление изображения с круглым углом.

person Muthukrishnan Rajendran    schedule 02.07.2017
comment
просто добавьте к нему cardCornerRadius. - person Daksh Gargas; 02.07.2017
comment
Денис, cardRadiud уже есть, проблема в дочернем фоне - person Muthukrishnan Rajendran; 02.07.2017
comment
Да, я сделал, поэтому я удалил свой комментарий. :п - person Daksh Gargas; 02.07.2017