650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/CA/wKioL1WormGS3JnvAAJMUGtuBjA121.jpg "title=" merchant _ Slidepager.png "alt=" Wkiol1wormgs3jnvaajmugtubja121.jpg "/>
1.
Package com.chencheng.meituan.fragment;
Import Com.astuetz.PagerSlidingTabStrip;
Import com.chencheng.meituan.view.MapOverLayActivity;
Import COM.YUCHEN.MEITUAN.R;
Import Com.yuchen.meituan.r.layout;
Import android.content.Intent;
Import Android.os.Bundle;
Import android.support.v4.app.Fragment;
Import Android.support.v4.app.FragmentManager;
Import Android.support.v4.app.FragmentPagerAdapter;
Import Android.support.v4.view.ViewPager;
Import Android.view.LayoutInflater;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.view.ViewGroup;
/**
* A Simple {@link Fragment} subclass.
*
*/
public class Shop0fragment extends Fragment implements Onclicklistener {
Private final string[] TITLES = {"All merchants", "Preferential merchants"};
Public Shop0fragment () {
Required empty Public constructor
}
@Override
Public View Oncreateview (layoutinflater inflater, ViewGroup container,
Bundle savedinstancestate) {
View layout = inflater.inflate (r.layout.fragment_shop0, NULL);
Layout.findviewbyid (R.ID.RL_MAP_BTN). Setonclicklistener (this);
Initviewpager (layout);
return layout;
}
private void Initviewpager (View layout) {
Viewpager Mpager = (viewpager) Layout.findviewbyid (R.id.pager);
Pagerslidingtabstrip TabStrip = (pagerslidingtabstrip) Layout.findviewbyid (r.id.tabs);
Fragmentmanager fm = Getchildfragmentmanager ();
Mpager.setadapter (new Bannerpageradapger (FM));
Tabstrip.setviewpager (Mpager);
}
Class Bannerpageradapger extends Fragmentpageradapter {
Public Bannerpageradapger (fragmentmanager FM) {
Super (FM);
}
@Override
Public charsequence getpagetitle (int position) {
return titles[position];
}
Public Fragment getItem (int position) {
int i =position%2;
Fragment Fragment;
if (i==0) {
fragment = new Shopfragment ();
}else{
Fragment=new shopfragment ();
}
Fragment.settitle (Titles[position]);
return fragment;
}
public int GetCount () {
return titles.length;
}
}
@Override
public void OnClick (View v) {
Switch (V.getid ()) {
Case R.ID.RL_MAP_BTN:
Surrounding
StartActivity (New Intent (Getactivity (), mapoverlayactivity.class));
Break
Default
Break
}
}
}
2. Modify the properties of indicator and underline inside the library Pagerslidingtabstrip
private int indicatorcolor = 0xff22b14c;
private int underlinecolor = 0x1a22b14c;
private int dividercolor = 0x00e61a5f;
Private Boolean shouldexpand = false;
Private Boolean textallcaps = true;
private int scrolloffset = 52;
private int indicatorheight = 2;
private int underlineheight = 4;
private int dividerpadding = 2;
private int tabpadding = 24;
private int dividerwidth = 2;
private int tabtextsize = 12;
private int tabtextcolor = 0xff22b14c;
CC US business interface plus slidepage Open source project