【发布时间】:2016-09-05 17:21:05
【问题描述】:
我的安卓设备是4.3,不能在cardView的角落工作:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/CardStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:scaleType="centerCrop"
app:cardUseCompatPadding="true"
card_view:cardBackgroundColor="@color/BlackTrans"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/txtDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageButton
android:id="@+id/imgbIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_serch" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
我在课堂上写了下面的代码,但还没有工作:
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
{
holder.CardStart.setCardElevation(0);
holder.CardStart.setBackgroundColor(ContextCompat.getColor(context,R.color.BlackTrans));
holder.CardStart.setRadius(5);
holder.CardStart.setUseCompatPadding(true);
}
【问题讨论】:
-
@TWL。我读了这个链接。这不是我的回应。
标签: android android-recyclerview android-cardview