本文整理汇总了Java中android.support.v4.view.WindowCompat类的典型用法代码示例。如果您正苦于以下问题:Java WindowCompat类的具体用法?Java WindowCompat怎么用?Java WindowCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WindowCompat类属于android.support.v4.view包,在下文中一共展示了WindowCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
Log.w(TAG, "onCreate()");
this.masterSecret = masterSecret;
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.conversation_activity);
fragment = initFragment(R.id.fragment_content, new ConversationFragment(),
masterSecret, dynamicLanguage.getCurrentLocale());
initializeReceivers();
initializeActionBar();
initializeViews();
initializeResources();
initializeSecurity(false, isDefaultSms).addListener(new AssertedSuccessListener<Boolean>() {
@Override
public void onSuccess(Boolean result) {
initializeDraft();
}
});
}
示例2: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
Log.w(TAG, "onCreate()");
this.masterSecret = masterSecret;
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.conversation_activity);
fragment = initFragment(R.id.fragment_content, new ConversationFragment(),
masterSecret, dynamicLanguage.getCurrentLocale());
initializeReceivers();
initializeActionBar();
initializeViews();
initializeResources();
initializeSecurity(false, isDefaultSms).addListener(new AssertedSuccessListener<Boolean>() {
@Override
public void onSuccess(Boolean result) {
initializeProfiles();
initializeDraft();
}
});
}
示例3: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
Log.w(TAG, "onCreate()");
this.masterSecret = masterSecret;
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.conversation_activity);
fragment = initFragment(R.id.fragment_content, new ConversationFragment(),
masterSecret, dynamicLanguage.getCurrentLocale());
initializeReceivers();
initializeActionBar();
initializeViews();
initializeResources();
initializeSecurity();
updateRecipientPreferences();
initializeDraft();
}
示例4: supportRequestWindowFeature
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
public boolean supportRequestWindowFeature(int featureId) {
switch (featureId) {
case WindowCompat.FEATURE_ACTION_BAR:
mHasActionBar = true;
return true;
case WindowCompat.FEATURE_ACTION_BAR_OVERLAY:
mOverlayActionBar = true;
return true;
case Window.FEATURE_PROGRESS:
mFeatureProgress = true;
return true;
case Window.FEATURE_INDETERMINATE_PROGRESS:
mFeatureIndeterminateProgress = true;
return true;
default:
return mActivity.requestWindowFeature(featureId);
}
}
示例5: initHelper
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
protected void initHelper() {
getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final FadingActionBarHelper helper = new FadingActionBarHelper();
mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url,
null);
helper.contentLayout(R.layout.layout_artist);
helper.actionBarBackground(R.drawable.ab_solid_lastfm);
helper.headerView(mUrlImageView);
final View v = helper.createView(this);
mUrlImageView.getLayoutParams().height = (int) (160 * getResources()
.getDisplayMetrics().density + 0.5f);
setContentView(v);
helper.initActionBar(this);
}
示例6: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
Bundle extras = getIntent().getExtras();
if (extras != null) {
topicTitle = extras.getString(Constants.topic.EXTRA_TITLE);
iconDrawableId = extras.getInt(Constants.topic.EXTRA_ICON_ID);
topicResId = extras.getInt(Constants.topic.EXTRA_DATA_FILE);
}
actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_White_Ramadan)));
actionBar.setTitle(Utilities.getBanglaSpannableString(topicTitle, this));
actionBar.setIcon(getResources().getDrawable(iconDrawableId));
actionBar.setDisplayShowHomeEnabled(true);
setContentView(R.layout.activity_topics);
}
示例7: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
Bundle extras = getIntent().getExtras();
if (extras != null) {
topicTitle = extras.getString(Constants.topic.EXTRA_TITLE);
iconDrawableId = extras.getInt(Constants.topic.EXTRA_ICON_ID);
topicResId = extras.getInt(Constants.topic.EXTRA_DATA_FILE);
}
actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_Green_Ramadan)));
actionBar.setTitle(Utilities.getBanglaSpannableString(topicTitle, this));
actionBar.setIcon(getResources().getDrawable(iconDrawableId));
actionBar.setDisplayShowHomeEnabled(true);
setContentView(R.layout.activity_saom_vonger_karon);
}
示例8: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
aid = getIntent().getIntExtra("aid", 0);
if (aid == 0)
return;
setContentView(R.layout.activity_comments);
MobclickAgent.onEvent(this, "view_comment");
ActionBar ab = getSupportActionBar();
ab.setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans));
mKeyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ActionBarUtil.setXiaomiFilterDisplayOptions(ab, false);
ab.setTitle("ac" + aid + " / 评论");
initCommentsBar();
initList();
requestData(1, true);
}
示例9: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.wrapper_cn_image_autoplay);
Intent intent = getIntent();
mImageList = intent.getStringArrayListExtra(EXTRA_IMAGE_LIST);
mTitle = intent.getStringExtra(EXTRA_TITLE);
mCacheDir = intent.getStringExtra(EXTRA_DIRECTORY);
mPeriod = intent.getIntExtra(EXTRA_PERIOD, SCROLL_PERIOD_DEFAULT);
mPosition = intent.getIntExtra(EXTRA_POSITION, 0);
// 默认进行图片缓存
mCacheOnDisc = intent.getBooleanExtra(EXTRA_CACHE_ON_DISC, true);
if (mPeriod <= 0)
{
mPeriod = SCROLL_PERIOD_DEFAULT;
}
if (TextUtils.isEmpty(mCacheDir))
{
// 没有地址不进行缓存, 后续看看有没有需要考虑没有地址使用默认地址的情况
// 原则上, 在设计时, 都提供存储地址应该比较合理
mCacheOnDisc = false;
}
if (TextUtils.isEmpty(mTitle))
{
int titleId = getResources().getIdentifier("app_name", "string", this.getPackageName());
mTitle = getString(titleId);
}
getSupportActionBar().show();
getSupportActionBar().setTitle(mTitle);
//getSupportActionBar().setSubtitle(title + "sub");
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
getUiHandler().postDelayed(new Runnable()
{
@Override
public void run()
{
getSupportActionBar().hide();
}
}, ACTIONBAR_HIDE_DELAYED);
SaveImageOptions saveOptions = new SaveImageOptions.Builder()
.medule("Image_AutoPlay")
.extraDir(mCacheDir)
.build();
DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.warn_image_empty)
.showImageOnFail(R.drawable.warn_image_error)
.cacheInMemory(true)
.cacheOnDisc(mCacheOnDisc)
.considerExifParams(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.saveImageOptions(saveOptions)
.build();
imageSwitcher = (XImageSwitcher) findViewById(R.id.imageSwitcher);
imageSwitcher.setFactory(this);
imageSwitcher.setOnClickListener(this);
imageSwitcher.addImagePath(mImageList);
imageSwitcher.setDisplayImageOptions(displayImageOptions);
imageSwitcher.startAutoScroll(mPeriod, mPosition);
}
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:70,代码来源:ImageAutoPlayImageSwitcherActivity.java
示例10: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The Action Bar is a window feature. The feature must be requested
// before setting a content view. Normally this is set automatically
// by your Activity's theme in your manifest. The provided system
// theme Theme.WithActionBar enables this for you. Use it as you would
// use Theme.NoTitleBar. You can add an Action Bar to your own themes
// by adding the element <item name="android:windowActionBar">true</item>
// to your style definition.
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
}
示例11: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide on content scroll requires an overlay action bar, so request one
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.action_bar_hide_scroll);
// Enable hide on scroll
getSupportActionBar().setHideOnContentScrollEnabled(true);
}
示例12: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
// Set framework uiOptions from the support metadata value
if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW,
ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
}
super.onCreate(savedInstanceState);
if (mHasActionBar) {
// If action bar is requested by inheriting from the appcompat theme,
// the system will not know about that. So explicitly request for an action bar.
mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
}
if (mOverlayActionBar) {
mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
}
/*
* This goofy move needs some explanation.
*
* The verifier on older platform versions has some interesting side effects if
* a class defines a method that takes a parameter of a type that doesn't exist.
* In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
* cannot override the onActionModeStarted/Finished methods without causing nastiness
* when it is loaded on older platform versions.
*
* Since these methods are actually part of the window callback and not intrinsic to
* Activity itself, we can install a little shim with the window instead that knows
* about the ActionMode class. Note that this means that any new methods added to
* Window.Callback in the future won't get proxied without updating the support lib,
* but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
*/
final Window w = mActivity.getWindow();
w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
示例13: initHelper
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
protected void initHelper() {
getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final FadingActionBarHelper helper = new FadingActionBarHelper();
mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
helper.contentLayout(R.layout.layout_artist);
helper.actionBarBackground(R.drawable.ab_solid_lastfm);
helper.headerView(mUrlImageView);
final View v = helper.createView(this);
mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
setContentView(v);
helper.initActionBar(this);
}
示例14: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DbManager.init(this);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.activity_main);
Bundle extras = getIntent().getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
preferenceHelper = new PreferenceHelper(this);
if (!preferenceHelper.getBoolean(Constants.IS_DB_CREATED)) {
CSVToDbHelper.readCSVAndInserIntoDb(this, R.raw.region, DbTableName.Region);
CSVToDbHelper.readCSVAndInserIntoDb(this, R.raw.timetable, DbTableName.TimeTable);
preferenceHelper.setBoolean(Constants.IS_DB_CREATED, true);
}
actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_White_Ramadan)));
actionBar.setDisplayShowTitleEnabled(false);
findViewById(R.id.tab_iftar_time).setOnClickListener(this);
findViewById(R.id.tab_saom).setOnClickListener(this);
findViewById(R.id.tab_nioat).setOnClickListener(this);
findViewById(R.id.tab_ramadan).setOnClickListener(this);
findViewById(R.id.tab_saom_vonger_karon).setOnClickListener(this);
findViewById(R.id.tab_tarabih).setOnClickListener(this);
iftarTime = (BanglaTextView) findViewById(R.id.tv_ifter_time);
seheriTime = (BanglaTextView) findViewById(R.id.tv_seheri_time);
timeTables = DbManager.getInstance().getAllTimeTables();
regions = DbManager.getInstance().getAllRegions();
}
示例15: onCreate
import android.support.v4.view.WindowCompat; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
ActionBarUtil.compatibleDeviceWithSB(this);
requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
ActionBarUtil.setXiaomiFilterDisplayOptions(getSupportActionBar(), false);
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans));
Bundle extras = getIntent().getExtras();
title = extras.getString("title");
getSupportActionBar().setTitle(title);
aid = extras.getInt("aid");
mList = extras.getStringArrayList(EXTRA_IMAGES);
int index = extras.getInt(EXTRA_INDEX,0);
if(index < 0) index = 0;
MobclickAgent.onEvent(this, "view_big_pic");
setContentView(R.layout.activity_images);
indexText = (TextView) findViewById(R.id.index);
if(ActionBarUtil.hasSB() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE){
setInfoBottomMargin(getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height));
}
pager = (MyViewPager) findViewById(R.id.pager);
pager.setAdapter(new ImageAdapter(getSupportFragmentManager(),mList));
pager.setOffscreenPageLimit(1);
pager.setOnPageChangeListener(this);
pager.setCurrentItem(index);
onPageSelected(index);
}