跟着时代的潮流,跟着android进化的路径,我采用的是最简单,
只能在android 5.0 以上才可以使用,现在大部分安卓机器都是5.0以上的。 使用android v7的view CardView就可以。
code如下:
<LinearLayout 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:orientation="vertical"
tools:context="com.dressplus.androidndk.activitys.CardViewActivity">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
app:cardBackgroundColor="@color/colorAccent"
app:cardCornerRadius="10dp"
app:cardElevation="4dp"
app:contentPadding="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/jiege" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
app:cardCornerRadius="40dp"
app:cardElevation="4dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/jiege" />
</android.support.v7.widget.CardView>
</LinearLayout>
网友评论