Before you start, go ahead.
Suddenly found a little bit of smell ... Do.. Know the gray #989898, know Blue 15,136,235 (escape ....
1, Study P chart
When I was a freshman I also used a lot of Adobe's software, yesterday to reopen my Photoshop, the computer prompted the lack of any. dll files, and finally got a morning, because the vc2012 run the library out of the problem, and finally found a software particularly useful: DirectX Repair, Can perfectly solve the problem of. dll loss.
UI footage I downloaded the https://github.com/google/material-design-icons in Google's icons material library.
Image transform color used photoshop paint bucket tool
Each button here requires two colors, and when clicked, the effect of the transform can be achieved.
Finally, you'll need a picture that puts four buttons at the bottom of the page.
Finally put these pictures into the drawable-hdpi
2. Binding controls in Contentfragment
Packagecom.vitoyan.myangtzeu.fragment;ImportAndroid.support.v4.view.ViewPager;ImportAndroid.view.View;ImportAndroid.widget.RadioGroup;ImportCOM.VITOYAN.MYANGTZEU.R;Importcom.vitoyan.myangtzeu.base.BaseFragment;ImportCom.vitoyan.myangtzeu.utils.LogUtil;/*** Vito-yan * function: Body fragment*/ Public classContentfragmentextendsbasefragment {PrivateViewpager Viewpager; PrivateRadiogroup Rg_main; @Override PublicView Initview () {LOGUTIL.E ("The body view is initialized."); View View= View.inflate (Context, r.layout.content_fragment,NULL); Viewpager=View.findviewbyid (R.id.viewpager); Rg_main=View.findviewbyid (R.id.rg_main); returnview; } @Override Public voidInitData () {Super. InitData (); LOGUTIL.E ("Body data is initialized"); //Set default Home page selectedRg_main.check (r.id.rb_home); }}
2, Content_fragment.xml is the bottom button layout file, in the linear layout package Radiogroup,radiogroup wrapped four button
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical"> <Com.vitoyan.myangtzeu.view.NoScrollViewPagerAndroid:id= "@+id/viewpager"Android:layout_width= "Match_parent"Android:layout_height= "0DP"Android:layout_weight= "1" /> <RadiogroupAndroid:id= "@+id/rg_main"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@drawable/bottom_tab_bg"android:orientation= "Horizontal"> <RadioButtonAndroid:id= "@+id/rb_home"Android:drawabletop= "@drawable/rb_home_drawable_selector"android:gravity= "Center"Android:text= "Home"style= "@style/bottom_tag_style" /> <RadioButtonAndroid:id= "@+id/rb_topic"Android:drawabletop= "@drawable/rb_topic_drawable_selector"android:gravity= "Center"Android:text= "topic"style= "@style/bottom_tag_style" /> <RadioButtonAndroid:id= "@+id/rb_find"Android:drawabletop= "@drawable/rb_find_drawable_selector"android:gravity= "Center"Android:text= "Discovery"style= "@style/bottom_tag_style" /> <RadioButtonAndroid:id= "@+id/rb_my"Android:drawabletop= "@drawable/rb_my_drawable_selector"android:gravity= "Center"Android:text= "my"style= "@style/bottom_tag_style" /> </Radiogroup></LinearLayout>
3. The Bottom_tag_style in STYLE.XM is the public button property
<Resources> <!--Base application theme. - <stylename= "Apptheme"Parent= "Theme.AppCompat.Light.DarkActionBar"> <!--Customize your theme here. - <Itemname= "Colorprimary">@color/colorprimary</Item> <Itemname= "Colorprimarydark">@color/colorprimarydark</Item> <Itemname= "Coloraccent">@color/coloraccent</Item> </style> <stylename= "Bottom_tag_style" > <!--Customize your theme here. - <Itemname= "Android:layout_width">Wrap_content</Item> <Itemname= "Android:layout_height">Wrap_content</Item> <Itemname= "Android:layout_gravity">Center_vertical</Item> <Itemname= "Android:button">@null</Item> <Itemname= "Android:drawablepadding">5dp</Item> <Itemname= "Android:textcolor">@drawable/bottom_textcolor_drawable_selector</Item> <Itemname= "Android:textsize">14sp</Item> <Itemname= "Android:layout_weight">1</Item> </style></Resources>
4, Noscrollviewpager in the layout file when the class is used, instantiate the class with the construction method, this method can not be less, less will crash.
PackageCom.vitoyan.myangtzeu.view;ImportAndroid.content.Context;ImportAndroid.support.v4.view.ViewPager;ImportAndroid.util.AttributeSet;Importandroid.view.MotionEvent;/*** Vito-yan * Function: Custom non-sliding Viewpager*/ Public classNoscrollviewpagerextendsViewpager {/*** This method is usually used when instantiating in code *@paramContext*/ PublicNoscrollviewpager (Context context) {Super(context); } /*** When using this class in the layout file, instantiate the class with this constructor method, this method can not be less, less will crash. * @paramContext *@paramAttrs*/ PublicNoscrollviewpager (Context context, AttributeSet attrs) {Super(context, attrs); } /*** Rewrite touch events, consume *@paramEV *@return */@Override Public Booleanontouchevent (motionevent ev) {return true; } @Override Public Booleanonintercepttouchevent (motionevent ev) {return false; }}
The specific source code can be viewed on my GitHub Https://github.com/Vito-Yan/MYangtzeu
Here we use Xutils to initialize the control
My grown-up app development tutorial second bullet: Finish contentfragment Bottom button