Android Imitation QQ home message and phone switch, first page of the head (completely with layout control)
First, put seven control layout codes
1.title_text_sel.xml the font color to be placed under the color folder
<?xml version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:state_checked=" true "android:color=" @color/blue "/> <item android: State_checked= "false" android:color= "@color/white"/></selector>
2.rb_bg_01.xml left RadioButton Background selection
<?xml version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:state_checked=" true "android:drawable=" @drawable/rb_bg_01t "></item> <item android:state_checked= "false" android:drawable= "@drawable/rb_bg_01f" ></item></selector >
3.rb_bg_01f.xml left RadioButton Background selection
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@color/blue"/> <corners android:topleftradius= "15dip" Android: bottomleftradius= "15dip"/> <stroke android:width= "1dip" android:color= "@color/white_drak"/> </shape>
4.rb_bg_01t.xml left RadioButton Background selection
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@color/white_drak"/> <corners android:topleftradius= "15dip" Android: bottomleftradius= "15dip"/> </shape>
5.rb_bg_02.xml right side RadioButton background selection
<?xml version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:state_checked=" true "android:drawable=" @drawable/rb_bg_02t "></item> <item android:state_checked= "false" android:drawable= "@drawable/rb_bg_02f" ></item></selector >
6.rb_bg_02f.xml right side RadioButton background selection
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@color/blue"/> <corners android:toprightradius= "15dip" Android: bottomrightradius= "15dip"/> <stroke android:width= "1dip" android:color= "@color/white_drak"/></ Shape>
7.rb_bg_02t.xml right side RadioButton background selection
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@color/white_drak"/> <corners android:toprightradius= "15dip" Android: bottomrightradius= "15dip"/> </shape>
Activity_main.xml Code
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Tools:context = "Com.example.atest.MainActivity" > <linearlayout android:layout_height= "wrap_content" android:background= "@color/blue" android:gravity= "center" android:layout_width= "Match_parent" > <radiogroup Android:id= "@+id/rg" android:layout_margin= "10dip" android:layout_width= "200dip" Android:layo ut_height= "wrap_content" android:layout_gravity= "center" android:orientation= "Horizontal" > <radiobutton android:id= "@+id/rb0" android:layout_height= "Wrap_content" Andro Id:layout_width= "0dip" android:layout_weight= "1" android:button= "@null" Android:tex t= "Message" android:checked= "true" Android:textsize= "16SP" android:gravity= "center" android:paddingtop= "6dip" a Ndroid:paddingbottom= "6dip" android:textcolor= "@color/title_text_sel" android:background= "@drawabl E/rb_bg_01 "/> <radiobutton android:id=" @+id/rb1 "android:layou t_height= "Wrap_content" android:layout_width= "0dip" android:layout_weight= "1" Andro id:text= "Phone" android:button= "@null" android:gravity= "center" android:textsize= "16SP" android:paddingtop= "6dip" android:paddingbottom= "6dip" android:textcolor= "@color/title_ Text_sel "android:background=" @drawable/rb_bg_02 "/> </RadioGroup> </linearlayout>< ;/relativelayout>
Colors.xml Color Value code
<?xml version= "1.0" encoding= "Utf-8"?><resources> <color name= "Blue" > #18B4ED </color> <color name= "White_drak" > #D0EFFA </color> <color name= "White" > #FFFFFF </color> </resources>
SOURCE Download: http://download.csdn.net/detail/pcaxb/9028951
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Imitation QQ home message and phone switch, first page of the head (completely with layout control)