android - Creating a button with an icon in the middle -
i'm trying replicate of , comment button in image:
http://i.imgur.com/parhgu6.png
i understand how create shape, i'm not sure how add image icon in middle of button (and "like" text).
here's shape layout have far:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">     <item>         <shape xmlns:android="http://schemas.android.com/apk/res/android"             android:shape="rectangle">              <solid android:color="@color/gray"/>             <size android:width="40dp" android:height="24dp"/>         </shape>     </item> </layer-list>   for button, how add drawable heart icon have next text "like". , comment button, how add drawable comment icon have , center in button?
this simple
<imagebutton     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:paddingleft="5dp"     android:paddingright="5dp"     android:src="@drawable/comments"     android:background="@drawable/rounded_corner_grey_bg"     android:layout_gravity="center"/>   and here rounded_corner_grey_bg.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">     <solid android:color="#d3d3d3"/>     <stroke android:width="3dip"         android:color="#d3d3d3" />     <corners android:radius="5dip"/>/> </shape>        
Comments
Post a Comment