如何在 Android 中将这个三角形附加到 cardview 中?
How can I attach this triangle with cardview in Android?
Android 中是否有任何特定组件,或者我必须使用视图制作三角形(在图像中显示为圆形)并附加到卡片上,但在我上传图像时它仍然与在图片。
有很多方法,但我的方法是:
你将在 photoshop 中创建一个像这样的图像(当然要好好测量它并定位所有设备(dp)),然后将它放在您的 drawable
文件夹中,并在您的 CardView 之上调用它。
假设图像被调用 image_traingle.jpg
你可以这样做
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:onClick="Contract"
android:layout_margin="10dp"
app:cardCornerRadius="7dp"
android:layout_height="90dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Imageview
android:layout_width="wrap_content"
android:gravity="left"
android:background="@color/colorPrimary"
android:src="drawable/image_triangle"
android:layout_height="match_parent" />
.
.
.
</LinearLayout>
</android.support.v7.widget.CardView>
Android 中是否有任何特定组件,或者我必须使用视图制作三角形(在图像中显示为圆形)并附加到卡片上,但在我上传图像时它仍然与在图片。
有很多方法,但我的方法是:
你将在 photoshop 中创建一个像这样的图像(当然要好好测量它并定位所有设备(dp)),然后将它放在您的 drawable
文件夹中,并在您的 CardView 之上调用它。
假设图像被调用 image_traingle.jpg
你可以这样做
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:onClick="Contract"
android:layout_margin="10dp"
app:cardCornerRadius="7dp"
android:layout_height="90dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Imageview
android:layout_width="wrap_content"
android:gravity="left"
android:background="@color/colorPrimary"
android:src="drawable/image_triangle"
android:layout_height="match_parent" />
.
.
.
</LinearLayout>
</android.support.v7.widget.CardView>