I'm struggling with the following:
I want to achieve this:
I've come to something with the following:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/drawable_gold_frame">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/gold_photo"
android:layout_width="@dimen/all_time_best_photo_size"
android:layout_height="@dimen/all_time_best_photo_size"
android:layout_margin="@dimen/all_time_best_frame_thickness"
app:shapeAppearanceOverlay="@style/CircleImageView" />
</LinearLayout>
<style name="CircleImageView" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">50%</item>
</style>
<dimen name="all_time_best_photo_size">70dp</dimen>
<dimen name="all_time_best_frame_thickness">5dp</dimen>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:thickness="@dimen/all_time_best_frame_thickness"
android:useLevel="false">
<gradient
android:startColor="@color/gold_gradient_start"
android:centerColor="@color/gold_gradient_end"
android:endColor="@color/gold_gradient_start"
android:angle="180" />
</shape>
the image iteself is then loaded using Glide. this looks like this:
where's the ring shape? well if I increase the margin for the ImageView it becomes visible:
android:layout_margin="20dp"
and android:layout_margin="15dp" (don't mind the color)
So the last one is the closest I can get, I guess I could fiddle around with margins and make it better, but I think that it might break with different device etc...
What I don't understand is why using the same dimen for the ring thickness and the ImageView margin doesn't work. Is there a more "safe" way to achieve this?
note that the frame size is the same in all pictures, I just cropped the screenshots very badly



