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


Java CoordinatorLayout.Behavior方法代碼示例

本文整理匯總了Java中android.support.design.widget.CoordinatorLayout.Behavior方法的典型用法代碼示例。如果您正苦於以下問題:Java CoordinatorLayout.Behavior方法的具體用法?Java CoordinatorLayout.Behavior怎麽用?Java CoordinatorLayout.Behavior使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.CoordinatorLayout的用法示例。


在下文中一共展示了CoordinatorLayout.Behavior方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@Override
public void setupDialog(Dialog dialog, int style) {
    LogUtils.footPrint();
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.fragment_add_list_dialog, null);
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        BottomSheetBehavior bottomSheetBehavior = ((BottomSheetBehavior) behavior);
        bottomSheetBehavior.setBottomSheetCallback(bottomSheetBehaviorCallback);
    }

    ButterKnife.bind(this, contentView);

    Window window = dialog.getWindow();
    if (window != null) {
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }

    presenter = new AddListPresenter(TodoRepository.getInstance());
    presenter.attachView(this);
}
 
開發者ID:mengdd,項目名稱:TodoRealm,代碼行數:25,代碼來源:AddListDialogFragment.java

示例2: onCreateDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_message, null);
    mSheet.setContentView(contentView);

    unbinder = ButterKnife.bind(this, mSheet);

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }

    onPostCreate(this);
    return mSheet;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:21,代碼來源:BottomSheetMessage.java

示例3: onCreateDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_emoticons, null);
    mSheet.setContentView(contentView);

    unbinder = ButterKnife.bind(this, mSheet);

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }

    onPostCreate(this);
    return mSheet;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:21,代碼來源:BottomSheetEmoticon.java

示例4: onCreateDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_share, null);
    mSheet.setContentView(contentView);
    unbinder = ButterKnife.bind(this, mSheet);
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();
    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }
    onPostCreate(this);
    return mSheet;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:17,代碼來源:BottomSheetShare.java

示例5: onCreateDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_recycler, null);
    mSheet.setContentView(contentView);

    unbinder = ButterKnife.bind(this, mSheet);

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setPeekHeight(ScreenUtil.dip2px(getContext(), PEEK_HEIGHT));
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }

    mToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp);
    mToolbar.setNavigationOnClickListener(this);

    onPostCreate(this);
    return mSheet;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:25,代碼來源:BottomSheetUsers.java

示例6: form

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
public static TranslateUpDownBehavior form(View view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (params == null || !(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("parent must be CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
    if (!(behavior instanceof TranslateUpDownBehavior)) {
        throw new IllegalArgumentException("the behavior must be TranslateUpDownBehavior");
    }
    return (TranslateUpDownBehavior) behavior;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:TranslateUpDownBehavior.java

示例7: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static <V extends View> ViewPagerBottomSheetBehavior<V> from(V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params)
            .getBehavior();
    if (!(behavior instanceof ViewPagerBottomSheetBehavior)) {
        throw new IllegalArgumentException(
                "The view is not associated with ViewPagerBottomSheetBehavior");
    }
    return (ViewPagerBottomSheetBehavior<V>) behavior;
}
 
開發者ID:Krupen,項目名稱:FabulousFilter,代碼行數:15,代碼來源:ViewPagerBottomSheetBehavior.java

示例8: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
/**
 * A utility function to get the {@link AnchorSheetBehavior} associated with the {@code view}.
 *
 * @param view The {@link View} with {@link AnchorSheetBehavior}.
 * @return The {@link AnchorSheetBehavior} associated with the {@code view}.
 */
@SuppressWarnings("unchecked")
public static <V extends View> AnchorSheetBehavior<V> from(V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
    if (!(behavior instanceof AnchorSheetBehavior)) {
        throw new IllegalArgumentException("The view is not associated with AnchorSheetBehavior");
    }
    return (AnchorSheetBehavior<V>) behavior;
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:19,代碼來源:AnchorSheetBehavior.java

示例9: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
public static <V extends View> BottomNavigationBehavior<V> from(@NonNull V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params)
            .getBehavior();
    if (!(behavior instanceof BottomNavigationBehavior)) {
        throw new IllegalArgumentException(
                "The view is not associated with BottomNavigationBehavior");
    }
    return (BottomNavigationBehavior<V>) behavior;
}
 
開發者ID:homeii,項目名稱:GxIconDIY,代碼行數:14,代碼來源:BottomNavigationBehavior.java

示例10: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
public static <V extends View> FooterBehavior from(V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("這個View不是CoordinatorLayout的子View");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
    if (!(behavior instanceof FooterBehavior)) {
        throw new IllegalArgumentException("這個View的Behaviro不是ScaleDownShowBehavior");
    }
    return (FooterBehavior) behavior;
}
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:12,代碼來源:FooterBehavior.java

示例11: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
/**
 * A utility function to get the {@link BottomSheetBehaviorV2} associated with the {@code view}.
 *
 * @param view The {@link View} with {@link BottomSheetBehaviorV2}.
 * @return The {@link BottomSheetBehaviorV2} associated with the {@code view}.
 */
@SuppressWarnings("unchecked")
public static <V extends View> BottomSheetBehaviorV2<V> from(V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params)
            .getBehavior();
    if (!(behavior instanceof BottomSheetBehaviorV2)) {
        throw new IllegalArgumentException(
                "The view is not associated with BottomSheetBehavior");
    }
    return (BottomSheetBehaviorV2<V>) behavior;
}
 
開發者ID:OhMyLob,項目名稱:Paper-Launcher,代碼行數:21,代碼來源:BottomSheetBehaviorV2.java

示例12: onCreateDialog

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_recycler, null);
    mSheet.setContentView(contentView);

    unbinder = ButterKnife.bind(this, mSheet);

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setPeekHeight(ScreenUtil.dip2px(getContext(), PEEK_HEIGHT));
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }


    mToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp);
    mToolbar.setNavigationOnClickListener(this);

    mToolbar.inflateMenu(R.menu.menu_generic_detail);
    mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            Toast.makeText(getContext(), "Showing your current favour state", Toast.LENGTH_SHORT).show();
            return true;
        }
    });

    mFavourite = mToolbar.getMenu().findItem(R.id.action_favor_state);
    onPostCreate(this);
    return mSheet;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:36,代碼來源:BottomSheetLikes.java

示例13: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
public static CommonBehavior from(View view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
    if (!(behavior instanceof CommonBehavior)) {
        throw new IllegalArgumentException("The view's behavior isn't an instance of CommonBehavior. " +
                "Try to check the [app:layout_behavior]");
    }
    return (CommonBehavior) behavior;
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:13,代碼來源:CommonBehavior.java

示例14: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
public static <V extends View> ScaleDownShowBehavior from(V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
    if (!(behavior instanceof ScaleDownShowBehavior)) {
        throw new IllegalArgumentException("The view is not associated with ScaleDownShowBehavior");
    }
    return (ScaleDownShowBehavior) behavior;
}
 
開發者ID:zuoni1018,項目名稱:CoordinatorLayoutExample-master,代碼行數:12,代碼來源:ScaleDownShowBehavior.java

示例15: from

import android.support.design.widget.CoordinatorLayout; //導入方法依賴的package包/類
static <V extends View> BottomNavigationBehavior<V> from(@NonNull V view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof CoordinatorLayout.LayoutParams)) {
        throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
    }
    CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params)
            .getBehavior();
    if (!(behavior instanceof BottomNavigationBehavior)) {
        throw new IllegalArgumentException(
                "The view is not associated with BottomNavigationBehavior");
    }
    return (BottomNavigationBehavior<V>) behavior;
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:14,代碼來源:BottomNavigationBehavior.java


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