如何在Android 4.3上的ContstraintLayout上添加半径到顶部和底部?

时间:2017-11-17 11:09:22

标签: android

Android 4.3。 这是我的xml layuout:

<android.support.constraint.ConstraintLayout 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">

    <ImageView
        android:id="@+id/imageViewPhoto"
        android:layout_width="match_parent"
        android:layout_height="@dimen/card_height"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/imageViewFavorite"
        android:layout_width="28dp"
        android:layout_height="28dp"
        android:src="@drawable/ic_like_inactive"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/titleTextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toStartOf="@+id/imageViewDownload"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageViewPhoto" />


    <TextView
        android:id="@+id/subTitleTextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="@+id/titleTextView"
        app:layout_constraintLeft_toLeftOf="@+id/titleTextView"
        app:layout_constraintTop_toBottomOf="@+id/titleTextView" />

    <ImageView
        android:id="@+id/imageViewDownload"
        android:layout_width="28dp"
        android:layout_height="28dp"
        app:layout_constraintBottom_toBottomOf="@+id/subTitleTextView"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/titleTextView"
        app:srcCompat="@drawable/ic_download_inactive" />


</android.support.constraint.ConstraintLayout>

结果如下:

container

我想在Android 4.3的顶部和底部添加半径角。我怎么能这样做?您可以在顶部看到 imageView ,并且在底部有 textView

也许使用drawable?

P.S。 CardView 无济于事,因为它无法在Android 4.3上运行。

0 个答案:

没有答案