Create a settings button with the image above and the text below

I link to this link, but it helps

Expected Result Output result

Source

<?xml version="1.0" encoding="utf-8"?> <layout 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"> <data> <variable name="collection" type="com.techryde.bajafresh.data.model.local.CollectionDb" /> </data> <RelativeLayout android:id="@+id/circle_layout" android:layout_width="160dp" android:layout_height="160dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:background="@drawable/whitecircle"> <RelativeLayout android:id="@+id/circle_layoutinner" android:layout_width="match_parent" android:layout_height="120dp" android:layout_above="@+id/rating_viewtv" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="@drawable/circle_inset_drawable"> <ImageView android:id="@+id/country_photo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" app:url="@{collection.imageUrl}" /> </RelativeLayout> <TextView android:id="@+id/rating_viewtv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="3dp" android:text="@{collection.collectionName}" android:textColor="@android:color/white" /> </RelativeLayout> </layout> 

whitecircle.xml

 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="0dp" android:shape="ring" android:thicknessRatio="2" android:useLevel="false"> <solid android:color="@android:color/holo_red_dark" /> </shape> 

circletwo.xml

 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="0dp" android:shape="ring" android:thicknessRatio="2" android:useLevel="false"> <!--<solid android:color="#ff9546" />--> <solid android:color="#ffffff" /> </shape> 

circle_insert_drawable.xml

 <inset xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/circletwo" android:insetTop="40dp" android:visible="true" /> 

I can’t understand what the problem is? If someone is faced with this problem, before he will be very useful for help. thanks

+1
source share
1 answer

you can easily create a button with a retractable top ...

 <Button android:layout_weight="wrap_content" android:layout_height="wrap_Content" android:drawableTop="@drawable/yourimage" android:background="your circle shap drawble"/> 
0
source

All Articles