本文整理匯總了Java中com.readystatesoftware.systembartint.SystemBarTintManager.setNavigationBarTintEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java SystemBarTintManager.setNavigationBarTintEnabled方法的具體用法?Java SystemBarTintManager.setNavigationBarTintEnabled怎麽用?Java SystemBarTintManager.setNavigationBarTintEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.readystatesoftware.systembartint.SystemBarTintManager
的用法示例。
在下文中一共展示了SystemBarTintManager.setNavigationBarTintEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@TargetApi(19)
private void setTranslucentStatus(boolean on) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.colorPrimary));
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
}
示例2: initWindowFlags
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
/**
* 初始化界麵的屬性
*/
private void initWindowFlags() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
ActivityComponent activityComponent = getActivityComponent();
SystemBarTintManager systemBarTintManager = activityComponent.getSystemBarTintManager();
systemBarTintManager.setNavigationBarTintEnabled(true);
systemBarTintManager.setStatusBarTintEnabled(true);
final int color = getResources().getColor(R.color.colorSplash);
systemBarTintManager.setStatusBarTintColor(color);
systemBarTintManager.setNavigationBarTintColor(color);
}
}
示例3: setStatusBarTranslate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
public static void setStatusBarTranslate(AppCompatActivity mActivity, int resId){
SystemBarTintManager tintManager = new SystemBarTintManager(mActivity);
if (resId== R.color.transparent){
// enable status bar tint
tintManager.setStatusBarTintEnabled(false);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(false);
//noinspection deprecation
}else {
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
// enable navigation bar tint
}
tintManager.setStatusBarTintColor(mActivity.getResources().getColor(resId));
}
示例4: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// mNewsItemBiz = new NewsItemBiz(this);
//使用tintManager設置狀態欄的顏色
mTintManager= new SystemBarTintManager(this);
// enable status bar tint
//mTintManager.setStatusBarTintEnabled(true);
if (isNavBarTransparent()) {
mTintManager.setStatusBarTintEnabled(true);
// 有虛擬按鍵時
if (isHasNavigationBar()) {
mTintManager.setNavigationBarTintEnabled(true);
}else{
mTintManager.setNavigationBarTintEnabled(false);
}
}
// set a custom tint color for all system bars
mTintManager.setTintColor(getResources().getColor(R.color.dark_primary_color));
// SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
}
示例5: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_three);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//透明狀態欄
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明導航欄
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// 激活狀態欄
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint 激活導航欄
tintManager.setNavigationBarTintEnabled(true);
//設置係統欄設置顏色
//tintManager.setTintColor(R.color.red);
//給狀態欄設置顏色
tintManager.setStatusBarTintResource(R.color.mask_tags_1);
//Apply the specified drawable or color resource to the system navigation bar.
//給導航欄設置資源
tintManager.setNavigationBarTintResource(R.color.mask_tags_1);
}
}
示例6: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@TargetApi(19)
public void setTranslucentStatus(Activity activity, boolean on) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
//tintManager.setNavigationBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
// tintManager.setStatusBarTintResource(R.color.colorPrimary);
}
}
示例7: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@TargetApi(19)
public void setTranslucentStatus(Activity activity, boolean on) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
//tintManager.setNavigationBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
// tintManager.setStatusBarTintResource(R.color.colorPrimary);
}
}
示例8: setBarColor
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
public void setBarColor(int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(color);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setTintColor(color);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(true);
}
}
示例9: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Timber.i("onCreate");
AVAnalytics.trackAppOpened(getIntent());
setContentView(provideContentViewId());
ButterKnife.inject(this);
if(toolbar!=null){
setSupportActionBar(toolbar);
}
if(!TextUtils.isEmpty(NavUtils.getParentActivityName(this))){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
if(Build.VERSION.SDK_INT <= 19){
tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(true);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.primary_dark));
}
}
示例10: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// to make the statusbar tinted in API 19 or above, won't make any
// difference in other devices
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
tintManager.setTintColor(Color.parseColor("#00796b"));
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new PrefFragment()).commit();
getActionBar().setDisplayHomeAsUpEnabled(true);
}
示例11: onPostCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onPostCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onPostCreate(savedInstanceState);
if ( mImmersionEnable &&
android.os.Build.VERSION.SDK_INT > 18) {
Window window = getWindow();
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setNavigationBarTintEnabled(true);
tintManager.setStatusBarTintEnabled(true);
tintManager.setTintColor(Color.parseColor("#ff009688"));
SystemBarConfig systemBarConfig = tintManager.getConfig();
findViewById(R.id.about_listview).setPadding(
0, systemBarConfig.getPixelInsetTop(getActionBar().isShowing()),
0, systemBarConfig.getPixelInsetBottom());
} else {
mImmersionEnable = false;
}
}
示例12: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ButterKnife.inject(this);
if (SharePref.getInstance(this).isFirstTime()) {
chooseFont();
SharePref.getInstance(this).noLongerFirstTime();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Log.d("Build Version", Build.VERSION.SDK_INT + "");
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.colorPrimaryDark));
}
}
示例13: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setIcon(R.drawable.logo_trans);
getActionBar().setDisplayHomeAsUpEnabled(true);
String token = FoursquareAccount.getInstance().getToken(this);
if(token == null || token.equals("")){
startActivity(new Intent(this, LoginActivity_.class));
finish();
}else{
api.setoAuthToken(token);
}
// create our manager instance after the content view is set
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
// set a custom tint color for all system bars
tintManager.setTintColor(getResources().getColor(R.color.blue));
}
示例14: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.translucent_layout);
tv=(TextView)this.findViewById(R.id.tv);
int mode=getIntent().getIntExtra("mode",0);
Log.d(TAG,"MODE:"+mode);
//當係統版本為4.4或者4.4以上時可以使用沉浸式狀態欄
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//透明狀態欄
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明導航欄
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
if (mode == 0) {
LinearLayout linear_bar=(LinearLayout)findViewById(R.id.linear_bar);
linear_bar.setVisibility(View.VISIBLE);
int statusHeight=getStatusBarHeight();
android.widget.LinearLayout.LayoutParams params=(android.widget.LinearLayout.LayoutParams )linear_bar.getLayoutParams();
params.height=statusHeight;
linear_bar.setLayoutParams(params);
tv.setText("係統方法沉浸式實現");
} else if (mode == 1) {
// create our manager instance after the content view is set
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// 激活狀態欄
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint 激活導航欄
tintManager.setNavigationBarTintEnabled(true);
//設置係統欄設置顏色
//tintManager.setTintColor(R.color.red);
//給狀態欄設置顏色
tintManager.setStatusBarTintResource(R.color.middle_red);
// 設置導航欄設置資源
tintManager.setNavigationBarTintResource(R.color.color_nav);
tv.setText("第三方庫沉浸式實現");
}
}
}
示例15: setupAppBar
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
/**
* Sets up a top-padding for the given app bar equal to the height of the status bar.
* This increases the length of the app bar so it fits nicely below the status bar.
* This method also sets the status bar transparency.
*
* @param appBar Toolbar to set padding to
* @param activity Activity - current activity
*/
public static void setupAppBar(Toolbar appBar, Activity activity) {
appBar.setPadding(0, getStatusBarHeight(activity.getResources()), 0, 0);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(true);
tintManager.setTintColor(Color.parseColor("#10000000"));
}