标签:android 仿qq首页的消息和电话的切换 首页的头部完全用布局控制 radiobutton仿qq头部 布局实现
Android 仿QQ首页的消息和电话的切换,首页的头部(完全用布局控制)
首先贴上七个控制布局代码
1.title_text_sel.xml 字体颜色的切换 放到color文件夹下面
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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代码
<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:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal"> <RadioButton android:id="@+id/rb0" android:layout_height="wrap_content" android:layout_width="0dip" android:layout_weight="1" android:button="@null" android:text="消息" android:checked="true" android:textSize="16sp" android:gravity="center" android:paddingTop="6dip" android:paddingBottom="6dip" android:textColor="@color/title_text_sel" android:background="@drawable/rb_bg_01"/> <RadioButton android:id="@+id/rb1" android:layout_height="wrap_content" android:layout_width="0dip" android:layout_weight="1" android:text="电话" 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>
<?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>
效果图
源码下载:http://download.csdn.net/detail/pcaxb/9028951
版权声明:本文为博主原创文章,未经博主允许不得转载。
Android 仿QQ首页的消息和电话的切换,首页的头部(完全用布局控制)
标签:android 仿qq首页的消息和电话的切换 首页的头部完全用布局控制 radiobutton仿qq头部 布局实现
原文地址:http://blog.csdn.net/pcaxb/article/details/47810329