Android 在圆形图像视图中可作为源绘制
所以我用这个库创建了一个像这样的圆形图像视图Android 在圆形图像视图中可作为源绘制,android,xml,android-layout,Android,Xml,Android Layout,所以我用这个库创建了一个像这样的圆形图像视图 <com.mikhaellopez.circularimageview.CircularImageView android:id="@+id/nav_header_profile_pic" android:layout_width="100dp" android:layout_height="100dp" android:gravity="center" android:src="@drawable/sq
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/nav_header_profile_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="center"
android:src="@drawable/square_shape"
android:foreground="@drawable/foreground_add_image"
app:civ_border_color="@color/colorPrimaryDark"
app:civ_border_width="2dp"
app:civ_shadow="true"
app:civ_shadow_radius="2"
app:civ_shadow_color="@color/dark_grey"/>
我有这样的可提取资源
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/nav_header_profile_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="center"
android:src="@drawable/square_shape"
android:foreground="@drawable/foreground_add_image"
app:civ_border_color="@color/colorPrimaryDark"
app:civ_border_width="2dp"
app:civ_shadow="true"
app:civ_shadow_radius="2"
app:civ_shadow_color="@color/dark_grey"/>
square_shape.xml
及
前台添加图像.xml
前景图像正在显示,但Android:SRC= @ Dababy/SuaRaySub形状没有显示。
作为我的知识,你只需要用这个来显示圆形视图中的图像。
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/ivCircularImage"
android:layout_width="300dp"
android:layout_height="300dp"
android:src="@drawable/homeLogo"
app:civ_border="true"
app:civ_border_color="#3f51b5"
app:civ_border_width="8dp"
app:civ_shadow="true"
app:civ_shadow_color="#3f51b5"
app:civ_shadow_radius="10" />
“android:src”标记用于图像源。 您需要使用“android:background”作为方形
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/nav_header_profile_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="center"
android:foreground="@drawable/foreground_add_image"
app:civ_border_color="@color/colorPrimaryDark"
app:civ_border_width="2dp"
app:civ_shadow="true"
app:civ_shadow_radius="2"
app:civ_shadow_color="@color/dark_grey"
android:background="@drawable/square_shape"
android:src="@drawable/your_image_file_name"/>
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/nav_header_profile_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="center"
android:foreground="@drawable/foreground_add_image"
app:civ_border_color="@color/colorPrimaryDark"
app:civ_border_width="2dp"
app:civ_shadow="true"
app:civ_shadow_radius="2"
app:civ_shadow_color="@color/dark_grey"
android:background="@drawable/square_shape"
android:src="@drawable/your_image_file_name"/>