本文整理汇总了Java中android.support.design.widget.AppBarLayout.addView方法的典型用法代码示例。如果您正苦于以下问题:Java AppBarLayout.addView方法的具体用法?Java AppBarLayout.addView怎么用?Java AppBarLayout.addView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.AppBarLayout
的用法示例。
在下文中一共展示了AppBarLayout.addView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disableSearchMode
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
private void disableSearchMode() {
if (searchMode) {
searchMode = false;
//display tabs again
AppBarLayout appbar = (AppBarLayout) findViewById(R.id.appbar);
appbar.removeView(tabLayout); //make sure we're not adding the tabLayout while it's already there
appbar.addView(tabLayout);
//display floating button
mFab.setVisibility(View.VISIBLE);
//hide searchbar
mSearchBar.setVisibility(View.GONE);
//refresh the fragment display
mViewPager.setAdapter(null);
mViewPager.setAdapter(mSectionsPagerAdapter);
}
}
示例2: onCreateView
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.content_notifications, container, false);
AppBarLayout appBarLayout = getActivity().findViewById(R.id.appbar);
if (appBarLayout.getChildCount() == 1) {
mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
mViewPager = rootView.findViewById(R.id.tab_container);
mViewPager.setAdapter(mSectionsPagerAdapter);
mTabLayout = new TabLayout(getActivity());
mTabLayout.setTabTextColors(
getResources().getColor(R.color.disabledGrey),
getResources().getColor(R.color.white)
);
mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
mTabLayout.setupWithViewPager(mViewPager);
appBarLayout.addView(mTabLayout);
}
return rootView;
}
示例3: insertTabs
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
private void insertTabs(ViewGroup container) {
View rootView = (View) container.getParent();
appBar = (AppBarLayout) rootView.findViewById(R.id.appbar);
tabs = new TabLayout(getActivity());
tabs.setTabTextColors(Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF"));
appBar.addView(tabs);
}