如何在影像视图中添加阴影?

时间:2017-10-24 11:32:22

标签: android border shadow

我正在尝试为我的imageview添加边框和阴影,该视图位于ConstraintLayout中。 我尝试使用9补丁图像,但它根本不起作用!

下面是包含imageview的布局。

<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">

    <android.support.constraint.Guideline
        android:id="@+id/guideline_vertical_start"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.04" />

    <ImageView
        android:id="@+id/list_item_google_cards_media_image"
        android:layout_width="0dp"
        android:layout_height="200dp"
        app:layout_constraintDimensionRatio="w,400:576"
        app:layout_constraintStart_toStartOf="@+id/guideline_vertical_start"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.8"
        android:layout_marginTop="8dp"
        android:scaleType="centerCrop"
        android:src="@drawable/default_image"
        android:contentDescription="@string/cd_main_image" />

</android.support.constraint.ConstraintLayout>

我希望有类似于下图的内容。 Result Expected

0 个答案:

没有答案
相关问题