Centering source image (android:src) for ImageButton in Android

For centering android:src in the ImageButton I use the next solution. First I need create 9-patch src image using next rules. Please look at the screenshot from draw9patch utility from Android SDK. Next you need add the 9-patch image into ImageButton like this: <ImageButton android:layout_width=”200dp” android:layout_height=”match_parent” android:scaleType=”fitXY” android:src=”@drawable/src_image” /> And Read more…

How to create custom groupIndicator for ExpandableListView group

Here is tutorial How to create custon groupIndicator for ExpandableListView in Andriod. Here is screenshot: To do it you need: 1. Create 9-patch images for normal and expanded state 2. Create selector with this 9-patch images <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_expanded=”true” android:drawable=”@drawable/group_indicator_expanded” /> <item android:drawable=”@drawable/group_indicator” /> </selector> 3. Set this selector Read more…