當前位置: 首頁>>代碼示例>>Java>>正文


Java CollapsingToolbarLayout.LayoutParams方法代碼示例

本文整理匯總了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);
//                }
//            }
//        });
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:47,代碼來源:StatusBarCompatKitKat.java

示例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]);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:14,代碼來源:RemindActivity.java

示例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);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:14,代碼來源:MemoActivity.java

示例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);
}
 
開發者ID:ximsfei,項目名稱:Android-skin-support,代碼行數:14,代碼來源:CollapsingToolbarLayoutActivity.java

示例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]);
}
 
開發者ID:woxingxiao,項目名稱:GracefulMovies,代碼行數:44,代碼來源:SideFragment.java


注:本文中的android.support.design.widget.CollapsingToolbarLayout.LayoutParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。