本文整理匯總了Java中com.readystatesoftware.systembartint.SystemBarTintManager.setStatusBarTintResource方法的典型用法代碼示例。如果您正苦於以下問題:Java SystemBarTintManager.setStatusBarTintResource方法的具體用法?Java SystemBarTintManager.setStatusBarTintResource怎麽用?Java SystemBarTintManager.setStatusBarTintResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.readystatesoftware.systembartint.SystemBarTintManager
的用法示例。
在下文中一共展示了SystemBarTintManager.setStatusBarTintResource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_common_listview);
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);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
containerView = (LinearLayout)findViewById(R.id.myLinearLayout);
context = this;
inflater = LayoutInflater.from(context);
listDataLoadWrap = new CommonListRequestWrap<T>(context, this, getBeanType());
pagingListViewWrap = getPagingListViewWrap(this);
loadListDataErrorViewWrap = new LoadListDataErrorViewWrap(this);
}
示例3: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
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);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
fragmentManager = getFragmentManager();
regToWx();
initActionBar();
initUpdate();
initViews();
initViewEvents();
showFragment(1);
}
示例4: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
if(intent == null){
finish();
return;
}
super.onCreate(savedInstanceState);
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);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
inflater = LayoutInflater.from(this);
mTencent = Tencent.createInstance(Globe.QQ_APP_ID, this);
mAuthInfo = new AuthInfo(this, Globe.SINA_APP_KEY, Globe.SINA_REDIRECT_URL, null);
mSsoHandler = new SsoHandler(this, mAuthInfo);
mIWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, Globe.SINA_APP_KEY);
mIWeiboShareAPI.registerApp();
}
示例5: attachToActivity
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
public void attachToActivity(Activity activity) {
mActivity = activity;
TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
android.R.attr.windowBackground
});
int background = a.getResourceId(0, 0);
a.recycle();
ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
decorChild.setBackgroundResource(background);
decor.removeView(decorChild);
addView(decorChild);
setContentView(decorChild);
decor.addView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
}
示例6: initTintManager
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
private void initTintManager() {
// 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(false);
// set a custom tint color for all system bars
// tintManager.setTintColor(getResources().getColor(R.color.dark_darker));
// set a custom navigation bar resource
// tintManager.setNavigationBarTintResource(R.color.dark_darker);
// set a custom status bar drawable
// tintManager.setStatusBarTintColor(getResources().getColor(R.color.dark_darker));
// Create SystemBarTintManager
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.dark_dark);
mBarTintManager = tintManager;
}
示例7: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
getSupportFragmentManager().beginTransaction().add(R.id.main_content_container, new ContentFragment()).commit();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.status_bar_color);
}
}
示例8: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donate);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.statusbar_color);
View mainContainer = findViewById(R.id.main_container);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mainContainer.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
}
donationButton = (Button) findViewById(R.id.button_donate);
githubButton = (Button) findViewById(R.id.button_github);
donationButton.setOnClickListener(this);
githubButton.setOnClickListener(this);
}
示例9: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
getActionBar().setDisplayHomeAsUpEnabled(true);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.statusbar_color);
View mainContentView = findViewById(android.R.id.content);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mainContentView.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
}
}
示例10: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new HipSpiceFragment_())
.commit();
}
setProgressBarVisibility(false);
setProgressBarIndeterminateVisibility(false);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.blue);
SpannableString spannableString = new SpannableString(getString(R.string.app_name));
spannableString.setSpan(
new TypefaceSpan(this, "OpenSans-Regular.ttf"),
0,
spannableString.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
);
getSupportActionBar().setTitle(spannableString);
}
示例11: 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("第三方庫沉浸式實現");
}
}
}
示例12: initSystemBar
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
/**
* 沉浸式狀態欄.
*/
public void initSystemBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(activity, true);
}
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
// 使用顏色資源
tintManager.setStatusBarTintResource(R.color.colorPrimary);
}
示例13: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_before_push_live);
setActionBarLayout(R.layout.actionbar_layout_push);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
}
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.green_bg);
enterPushBtn = (ImageButton) findViewById(R.id.enter_topush);
mPush_room_url = (EditText) findViewById(R.id.push_room_url);
enterPushBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPushAd_url = mPush_room_url.getText().toString().trim();
Intent intent = new Intent(BeforePushLiveActivity.this, PushLiveActivity.class);
intent.putExtra("pushUrl",mPushAd_url);
startActivity(intent);
overridePendingTransition(R.anim.magnify_fade_in, R.anim.magnify_fade_out);
}
});
}
示例14: setStatusBarColor
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
/**
* 需要在setContentview之後再調用
* @param activity
*/
public static void setStatusBarColor(Activity activity,int colorId){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(activity,true);
SystemBarTintManager mTintManager = new SystemBarTintManager(activity);
mTintManager.setStatusBarTintEnabled(true);
mTintManager.setStatusBarTintResource(colorId);
}
}
示例15: setStatusBarColor
import com.readystatesoftware.systembartint.SystemBarTintManager; //導入方法依賴的package包/類
/**
* 修改狀態欄顏色,支持4.4以上版本
*
* @param activity
* @param colorId
*/
public static void setStatusBarColor(Activity activity, int colorId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(colorId));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//使用SystemBarTint庫使4.4版本狀態欄變色,需要先將狀態欄設置為透明
transparencyBar(activity);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(colorId);
}
}