本文整理匯總了Java中android.support.v4.view.PagerTabStrip.setBackgroundColor方法的典型用法代碼示例。如果您正苦於以下問題:Java PagerTabStrip.setBackgroundColor方法的具體用法?Java PagerTabStrip.setBackgroundColor怎麽用?Java PagerTabStrip.setBackgroundColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.view.PagerTabStrip
的用法示例。
在下文中一共展示了PagerTabStrip.setBackgroundColor方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initView
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
protected void initView(Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("下載管理");
toolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(toolbar);
toolbar.setOnMenuItemClickListener(this);
tabbar = (PagerTabStrip)findViewById(R.id.tabbar);
mViewPager = (ViewPager)findViewById(R.id.viewpager);
FragmentManager fm = getSupportFragmentManager();
fragmentAdapter = new FragmentAdapter(fm);
mViewPager.setOffscreenPageLimit(2);
mViewPager.setAdapter(fragmentAdapter);
tabbar.setTextColor(ContextCompat.getColor(this,R.color.write));
tabbar.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
tabbar.setTabIndicatorColor(ContextCompat.getColor(this,R.color.colorAccent));
}
示例2: onCreateView
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_viewpager, container, false);
viewPager = (ViewPager)rootView.findViewById(R.id.view_pager);
viewPager.setAdapter(new ListPagerAdapter(getChildFragmentManager()));
tabStrip = (PagerTabStrip)rootView.findViewById(R.id.tab_strip);
tabStrip.setBackgroundColor(getResources().getColor(R.color.toolbar_background));
tabStrip.setTextColor(getResources().getColor(R.color.dark_text));
tabStrip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.textSizeTC3));
tabStrip.setTabIndicatorColor(getResources().getColor(R.color.rdio_blue));
return rootView;
}
示例3: init
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
public void init(){
viewPager =(ViewPager) findViewById(R.id.viewpager);
tabStrip =(PagerTabStrip) findViewById(R.id.pagertab);
inflater =this.getLayoutInflater().from(this);
staff =inflater.inflate(R.layout.about_staff, null);
update =inflater.inflate(R.layout.about_update,null);
tabStrip.setTabIndicatorColor(Color.rgb(255, 255, 255)); //FF9C95 RGB 255, 156, 149
tabStrip.setDrawFullUnderline(true);
tabStrip.setTextColor(Color.WHITE);
tabStrip.setBackgroundColor(Color.rgb(154, 205, 50));
viewList .add(staff);
viewTitle .add("STAFF");
viewList .add(update);
viewTitle .add("檢查更新");
viewPager .setAdapter(new MyPagerAdapter(viewList, viewTitle));
}
示例4: UIupdater
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
UIupdater(Context context)
{
this.context=context;
//獲取布局
LayoutInflater flater = LayoutInflater.from(context);
mview = flater.inflate(R.layout.mview, null);
pager = (ViewPager) mview.findViewById(R.id.viewpager);
tabStrip = (PagerTabStrip) mview.findViewById(R.id.tabstrip);
button=(Button)mview.findViewById(R.id.buttonSet);
//取消tab下麵的長橫線
tabStrip.setDrawFullUnderline(false);
//設置tab的背景色
//tabStrip.setBackgroundColor(Color.argb(255, 111, 40, 98));
tabStrip.setBackgroundColor(Color.argb(255, 26, 209, 255));
//設置當前tab頁簽的下劃線顏色
tabStrip.setTabIndicatorColor(Color.argb(255, 26, 209, 255));
tabStrip.setTextSpacing(80);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, addcity.class);
context.startActivity(intent);
((MyActivity)context).finish();
}
});
}
示例5: onCreate
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
titlelist = new ArrayList<String>();
fraglist = new ArrayList<Fragment>();
urlFragment = new URLFragment();
cacheFragment = new CacheFragment();
settingFragment = new SettingFragment();
cachingFragment = new CachingFragment();
fraglist.add(cacheFragment);
fraglist.add(cachingFragment);
fraglist.add(urlFragment);
fraglist.add(settingFragment);
pager_tab = (PagerTabStrip)findViewById(R.id.pager_tab);
pager_tab.setTabIndicatorColor(getResources().getColor(R.color.colorAccent));
pager_tab.setDrawFullUnderline(false);
pager_tab.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
pager_tab.setTextSpacing(50);
titlelist.add("已完成");
titlelist.add("未完成");
titlelist.add("播放");
titlelist.add("設置");
viewPager = (ViewPager)findViewById(R.id.my_viewpager);
verifyStoragePermissions(this);
}
示例6: init
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
public void init() {
viewPager = (ViewPager) findViewById(R.id.viewpager);
tabStrip = (PagerTabStrip) findViewById(R.id.pagertab);
inflater = this.getLayoutInflater().from(this);
View intro0 = inflater.inflate(R.layout.intro_0, null);
View intro1 = inflater.inflate(R.layout.intro_1, null);
View intro2 = inflater.inflate(R.layout.intro_2, null);
View intro3 = inflater.inflate(R.layout.intro_3, null);
View intro4 = inflater.inflate(R.layout.intro_4, null);
tabStrip.setTabIndicatorColor(Color.rgb(255, 255, 255)); // FF9C95 RGB
// 255, 156,
// 149
tabStrip.setDrawFullUnderline(true);
tabStrip.setTextColor(Color.WHITE);
tabStrip.setBackgroundColor(Color.rgb(154, 205, 50));
viewList.add(intro0);
viewTitle.add("0");
viewList.add(intro1);
viewTitle.add("1");
viewList.add(intro2);
viewTitle.add("2");
viewList.add(intro3);
viewTitle.add("3");
viewList.add(intro4);
viewTitle.add("4");
viewPager.setAdapter(new MyPagerAdapter(viewList, viewTitle));
viewPager.setOnPageChangeListener(this);
}
示例7: onCreate
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewpager);
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getFragmentManager()) {
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return MainFragment.getInstance();
case 1:
return MovingFragment.getInstance();
case 2:
return BehaviorFragment.getInstance();
case 3:
return OverlayFragment.getInstance();
// case 2:
// return TestingActivity.getInstance();
}
return new Fragment();
}
@Override
public String getPageTitle(int pos) {
switch (pos) {
case 0:
return getResources().getString(R.string.pref_main_top_title);
case 1:
return getResources().getString(R.string.pref_movable_top_title);
case 2:
return getResources().getString(R.string.pref_behavior_title);
case 3:
return getResources().getString(R.string.pref_overlay_title);
// case 2:
// return getResources().getString(R.string.pref_testing_top_title);
}
return "";
}
@Override
public int getCount() {
return 4;
}
};
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
viewPager.setAdapter(adapter);
PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip);
pts.setTabIndicatorColor(0xFF333333);
pts.setTextColor(0xFF111111);
pts.setBackgroundColor(Color.TRANSPARENT);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(0xFFAA0000));
testSettings(true);
}
示例8: onCreate
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 設置應用單獨的地圖存儲目錄,在下載離線地圖或初始化地圖時設置
MapsInitializer.sdcardDir = PathConstants.getOfflineMapPath();
setContentView(R.layout.activity_offline_map);
//默認顯示標題
getSupportActionBar().setDisplayShowTitleEnabled(true);
//標題左邊返回箭頭
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setTitle(R.string.offlineMap);
viewpager = (ViewPager) findViewById(R.id.viewpager);
pagertab = (PagerTabStrip) findViewById(R.id.pagertab);
pagertab.setTabIndicatorColor(getResources().getColor(R.color.blue14));
pagertab.setDrawFullUnderline(false);
pagertab.setBackgroundColor(getResources().getColor(R.color.green6));
pagertab.setTextSpacing(50);
LayoutInflater inf = LayoutInflater.from(activity);
View v1 = inf.inflate(R.layout.view_offline_all, null, false);
lvAll = (ListView) v1.findViewById(R.id.lvAll);
spProvince = (Spinner) v1.findViewById(R.id.spProvince);
views.add(v1);
View v2 = inf.inflate(R.layout.view_offline_down, null, false);
lvDowning = (ListView) v2.findViewById(R.id.lvDowning);
views.add(v2);
titles.add(getResources().getString(R.string.offlineAllCity));
titles.add(getResources().getString(R.string.offlineDownManager));
viewpager.setOffscreenPageLimit(2);
viewpager.setAdapter(new MyPagerAdapter());
mAllAdapter = new DownAdapter();
lvAll.setAdapter(mAllAdapter);
mManagerAdapter = new DownAdapter();
lvDowning.setAdapter(mManagerAdapter);
initMapManager();
}
示例9: onCreate
import android.support.v4.view.PagerTabStrip; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.activity_main);
//用於永遠顯示3個點
getOverflowMenu();
cr = getContentResolver();
Boolean isFirstIn = false;
SharedPreferences pref = getSharedPreferences(SETNAME, 0);
//取得相應的值,如果沒有該值,說明還未寫入,用true作為默認值
isFirstIn = pref.getBoolean("isFirstIn", true);
if (isFirstIn) {
pref.edit().putBoolean("isFirstIn", false).apply();
}
Thread netThread = new Thread() {
public void run() {
new NetUtil(MainActivity.this).update();
}
};
netThread.start();
//停止加載主線程,等待數據下載(可能要動畫)
try {
netThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pagertab);
pagerTabStrip.setTabIndicatorColor(getResources().getColor(R.color.gold));
pagerTabStrip.setDrawFullUnderline(true);
pagerTabStrip.setBackgroundColor(getResources().getColor(R.color.azure));
pagerTabStrip.setTextSpacing(50);
ViewPager mViewPager = (ViewPager) findViewById(R.id.viewpager);
fragmentList = new ArrayList<Fragment>();//ViewPager中顯示的數據
ArrayList<String> titleList = new ArrayList<String>();// 標題數據
//添加數據
fragmentList.add(new ViewPagerFragment0());
fragmentList.add(new ViewPagerFragment1());
fragmentList.add(new ViewPagerFragment2());
fragmentList.add(new ViewPagerFragment3());
viewPagerFragment2 = ((ViewPagerFragment2)fragmentList.get(2));
titleList = new ArrayList<String>();// 每個頁麵的Title數據
titleList.add(getResources().getString(R.string.page0_title));
titleList.add(getResources().getString(R.string.page1_title));
titleList.add(getResources().getString(R.string.page2_title));
titleList.add(getResources().getString(R.string.page3_title));
mViewPager.setAdapter(new MyPagerFragmentAdapter(
getSupportFragmentManager(), fragmentList, titleList));
mViewPager.setCurrentItem(2);
mViewPager.setOffscreenPageLimit(4);
}