本文整理汇总了Java中com.flyco.systembar.SystemBarHelper类的典型用法代码示例。如果您正苦于以下问题:Java SystemBarHelper类的具体用法?Java SystemBarHelper怎么用?Java SystemBarHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemBarHelper类属于com.flyco.systembar包,在下文中一共展示了SystemBarHelper类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mNavigationView.setNavigationItemSelectedListener(this);
int color = getResources().getColor(R.color.colorPrimary);
//方法1:删除DrawerLayout所在布局中所有fitsSystemWindows属性,尤其是DrawerLayout的fitsSystemWindows属性
SystemBarHelper.tintStatusBarForDrawer(this, mDrawerLayout, color);
//方法2:可以版本判断在5.0以上不调用该方法, 使用系统自带
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// StatusBarCompat.tintStatusBarForDrawer(this, mDrawerLayout, color);
// }
SystemBarHelper.setPadding(this, mNavigationView.getHeaderView(0));
HomeFragment homeFragment = HomeFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.replace(R.id.content, homeFragment)
.commit();
}
示例2: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.title_couse);
setSupportActionBar(toolbar);
int color = getResources().getColor(R.color.colorPrimary);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
SystemBarHelper.tintStatusBar(this, color);
SystemBarHelper.tintStatusBarForDrawer(this, drawerLayout, color);
EventBus.getDefault().register(this);
initData();
initView();
initUI();
}
示例3: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statusbar_darkmode);
ButterKnife.bind(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (SystemBarHelper.isMIUI6Later() || SystemBarHelper.isFlyme4Later() || Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
SystemBarHelper.setStatusBarDarkMode(this);
SystemBarHelper.tintStatusBar(this, Color.parseColor("#eaeaea"), 0);
} else {
SystemBarHelper.tintStatusBar(this, Color.parseColor("#bbbbbb"), 0);
}
}
}
示例4: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statusbar_tint);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("状态栏着色");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
SystemBarHelper.tintStatusBar(this, getResources().getColor(R.color.colorPrimary));
ArrayList<String> mNames = new ArrayList<>();
for (int i = 0; i < 20; i++) {
mNames.add("状态栏着色");
}
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
mRecyclerView.setAdapter(new SingleTypeAdapter<String>(mNames, R.layout.item_home_fragment) {
@Override
public void bindView(ViewHolder holder, int position, View itemView) {
TextView mItem = ButterKnife.findById(itemView, R.id.item);
mItem.setText(getDataList().get(holder.getAdapterPosition()) + "-" + holder.getAdapterPosition());
}
});
}
示例5: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statusbar_immersive_3);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
SystemBarHelper.immersiveStatusBar(this, 0);
SystemBarHelper.setHeightAndPadding(this, mToolbar);
mAppbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
// boolean showTitle = mCollapsingToolbar.getHeight() + verticalOffset <= mToolbar.getHeight();
boolean showTitle = mCollapsingToolbar.getHeight() + verticalOffset <= mToolbar.getHeight() * 2;
mNickname.setVisibility(showTitle ? View.VISIBLE : View.GONE);
}
});
SimpleViewPagerAdapter adapter = new SimpleViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(SimpleFragment.newInstance("Android"), "Android");
adapter.addFragment(SimpleFragment.newInstance("iOS"), "iOS");
adapter.addFragment(SimpleFragment.newInstance("Html5"), "Html5");
mViewpager.setAdapter(adapter);
mTabs.setupWithViewPager(mViewpager);
}
示例6: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statusbar_immersive_2);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("H07000223");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
//method 1
SystemBarHelper.immersiveStatusBar(this);
SystemBarHelper.setHeightAndPadding(this, mToolbar);
//method 2,分别处理4.4调用SystemBarHelper方法,5.0以上使用系统方法
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// SystemBarHelper.immersiveStatusBar(this);
// SystemBarHelper.setHeightAndPadding(this, mToolbar);
// }
ArrayList<String> mNames = new ArrayList<>();
for (int i = 0; i < 20; i++) {
mNames.add("状态栏沉浸");
}
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
mRecyclerView.setAdapter(new SingleTypeAdapter<String>(mNames, R.layout.item_home_fragment) {
@Override
public void bindView(ViewHolder holder, int position, View itemView) {
TextView mItem = ButterKnife.findById(itemView, R.id.item);
mItem.setText(getDataList().get(holder.getAdapterPosition()) + "-" + holder.getAdapterPosition());
}
});
}
示例7: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_school_card);
ButterKnife.bind(this);
toolbar.setTitle("一卡通");
setSupportActionBar(toolbar);
SystemBarHelper.tintStatusBar(this, getResources().getColor(R.color.colorPrimary));
initVIew();
initData();
showLoginDialog();
initListener();
}
示例8: initStatusBar
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
private void initStatusBar() {
//设置StatusBar透明
SystemBarHelper.immersiveStatusBar(this);
SystemBarHelper.setHeightAndPadding(this, mToolbar);
}
示例9: initStatusBar
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
private void initStatusBar() {
SystemBarHelper.tintStatusBarForDrawer(this, mDrawer, ArmsUtils.getColor(this, R.color.colorPrimary));
SystemBarHelper.setPadding(this, mNav.getHeaderView(0));
SystemBarHelper.setPadding(this, mLlRoot);
}
示例10: onCreate
import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_statusbar_immersive_1);
SystemBarHelper.immersiveStatusBar(this);
}