本文整理匯總了Java中android.support.design.widget.CollapsingToolbarLayout.LayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java CollapsingToolbarLayout.LayoutParams方法的具體用法?Java CollapsingToolbarLayout.LayoutParams怎麽用?Java CollapsingToolbarLayout.LayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.design.widget.CollapsingToolbarLayout
的用法示例。
在下文中一共展示了CollapsingToolbarLayout.LayoutParams方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setStatusBarColorForCollapsingToolbar
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
/**
* compat for CollapsingToolbarLayout
* 1. set Window Flag : WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
* 2. set FitsSystemWindows for views.
* 3. removeFakeStatusBarViewIfExist
* 4. removeMarginTopOfContentChild
* 5. add OnOffsetChangedListener to change statusBarView's alpha
*/
public static void setStatusBarColorForCollapsingToolbar(Activity activity, final AppBarLayout appBarLayout, final CollapsingToolbarLayout collapsingToolbarLayout,
Toolbar toolbar, int statusColor) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
ViewGroup mContentView = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
View mContentChild = mContentView.getChildAt(0);
mContentChild.setFitsSystemWindows(false);
((View) appBarLayout.getParent()).setFitsSystemWindows(false);
appBarLayout.setFitsSystemWindows(false);
collapsingToolbarLayout.setFitsSystemWindows(false);
collapsingToolbarLayout.getChildAt(0).setFitsSystemWindows(false);
toolbar.setFitsSystemWindows(true);
if (toolbar.getTag() == null) {
CollapsingToolbarLayout.LayoutParams lp = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
lp.height += getStatusBarHeight(activity);
toolbar.setLayoutParams(lp);
toolbar.setTag(true);
}
int statusBarHeight = getStatusBarHeight(activity);
removeFakeStatusBarViewIfExist(activity);
removeMarginTopOfContentChild(mContentChild, statusBarHeight);
// final View statusView = addFakeStatusBarView(activity, statusColor, statusBarHeight);
// appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
// @Override
// public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
// if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getStatusBarScrim().getIntrinsicHeight()) {
// if (statusView.getAlpha() == 0) {
// statusView.animate().alpha(1f).setDuration(collapsingToolbarLayout.getScrollBarFadeDuration()).start();
// }
// } else {
// statusView.setAlpha(0);
// }
// }
// });
}
示例2: createViewInstance
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
public FrameLayout createViewInstance(ThemedReactContext context) {
FrameLayout view = new FrameLayout(context);
CollapsingToolbarLayout.LayoutParams params = new CollapsingToolbarLayout.LayoutParams(
CollapsingToolbarLayout.LayoutParams.MATCH_PARENT,
CollapsingToolbarLayout.LayoutParams.WRAP_CONTENT
);
params.setCollapseMode(CollapsingToolbarLayout.LayoutParams.COLLAPSE_MODE_PARALLAX);
view.setLayoutParams(params);
return view;
}
開發者ID:cesardeazevedo,項目名稱:react-native-collapsing-toolbar,代碼行數:12,代碼來源:CollapsingParallaxManager.java
示例3: addView
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
public void addView(CollapsingToolbarLayoutView parent, View child, int index) {
super.addView(parent, child, index);
if (child instanceof Toolbar) {
Toolbar toolbar = (Toolbar) child;
int toolbarHeight = (int) PixelUtil.toPixelFromDIP(height);
CollapsingToolbarLayout.LayoutParams params = new CollapsingToolbarLayout.LayoutParams(
CollapsingToolbarLayout.LayoutParams.MATCH_PARENT,
toolbarHeight
);
params.setCollapseMode(CollapsingToolbarLayout.LayoutParams.COLLAPSE_MODE_PIN);
toolbar.setLayoutParams(params);
toolbar.requestLayout();
}
}
開發者ID:cesardeazevedo,項目名稱:react-native-collapsing-toolbar,代碼行數:16,代碼來源:CollapsingToolbarLayoutManager.java
示例4: showDateTimeMsg
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
public void showDateTimeMsg() {
mIvHeader.setImageResource(R.drawable.pic_remind_bar);
android.support.design.widget.CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) mIvHeader.getLayoutParams();
params.rightMargin = 0;
params.topMargin = 16;
mIvHeader.setLayoutParams(params);
mLlAccount.setVisibility(View.GONE);
mRlDatetime.setVisibility(View.VISIBLE);
mTbAssist.setTitle("提醒");
mTvDate.setText(new StringBuilder().append(mDateTimes[0]).append(" ").append(AssistUtils.getWeekDay()));
mTvTime.setText(mDateTimes[1]);
}
示例5: initView
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
private void initView() {
mIvHeader.setImageResource(R.drawable.pic_memo_bar);
android.support.design.widget.CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) mIvHeader.getLayoutParams();
params.rightMargin = 0;
params.topMargin = 16;
mIvHeader.setLayoutParams(params);
mRlDatetime.setVisibility(View.GONE);
mLlAccount.setVisibility(View.GONE);
mTbAssist.setTitle("備忘");
mMemoAdapter = new MemoAdapter();
mAssistRecyclerview.setAdapter(mMemoAdapter);
}
示例6: initParallaxValues
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
private void initParallaxValues() {
CollapsingToolbarLayout.LayoutParams petDetailsLp =
(CollapsingToolbarLayout.LayoutParams) mIvPlaceholder.getLayoutParams();
CollapsingToolbarLayout.LayoutParams petBackgroundLp =
(CollapsingToolbarLayout.LayoutParams) mFlTitleContainer.getLayoutParams();
petDetailsLp.setParallaxMultiplier(0.9f);
petBackgroundLp.setParallaxMultiplier(0.3f);
mIvPlaceholder.setLayoutParams(petDetailsLp);
mFlTitleContainer.setLayoutParams(petBackgroundLp);
}
示例7: setParallaxMultiplier
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@ReactProp(name = "parallaxMultiplier")
public void setParallaxMultiplier(FrameLayout view, float multiplier) {
CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) view.getLayoutParams();
params.setParallaxMultiplier(multiplier);
view.setLayoutParams(params);
}
開發者ID:cesardeazevedo,項目名稱:react-native-collapsing-toolbar,代碼行數:7,代碼來源:CollapsingParallaxManager.java
示例8: onViewCreated
import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getArguments() != null) {
mAppBarLayout.setExpanded(getArguments().getBoolean(ARG_SHOULD_EXPAND), false);
}
CollapsingToolbarLayout.LayoutParams lp = (CollapsingToolbarLayout.LayoutParams) mToolbar.getLayoutParams();
lp.topMargin = Util.getStatusBarHeight();
mToolbar.setLayoutParams(lp);
playFabAnimation();
displayUI();
mThemeActivity.setSupportActionBar(mToolbar);
if (mThemeActivity.getSupportActionBar() != null) {
mThemeActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
if (isAnimRunning)
return;
onSideSwitch(mSwitch);
Colorful.config(getContext()).night(checked).apply();
}
});
mFab.setImageDrawable(tintDrawableWithColor(R.drawable.svg_ic_windmill,
Colorful.getThemeDelegate().getAccentColor().getColorRes()));
mPrimaryColorImg.setImageDrawable(tintDrawableWithColor(R.drawable.svg_ic_suit,
Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
mAccentColorImg.setImageDrawable(tintDrawableWithColor(R.drawable.svg_ic_tie,
Colorful.getThemeDelegate().getAccentColor().getColorRes()));
String[] quotes = getResources().getStringArray(R.array.quotes);
int index = new Random().nextInt(quotes.length);
mQuoteText.setTextWithHtml(quotes[index]);
}