本文整理汇总了Java中android.support.design.widget.BottomSheetBehavior.from方法的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetBehavior.from方法的具体用法?Java BottomSheetBehavior.from怎么用?Java BottomSheetBehavior.from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.BottomSheetBehavior
的用法示例。
在下文中一共展示了BottomSheetBehavior.from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleBottomSheet
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private static void toggleBottomSheet(View bottomSheet) {
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
int state = bottomSheetBehavior.getState();
switch (state) {
case BottomSheetBehavior.STATE_COLLAPSED:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
break;
case BottomSheetBehavior.STATE_HIDDEN:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
case BottomSheetBehavior.STATE_EXPANDED:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
break;
}
}
示例2: ui
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void ui(View rootView) {
albumArt = (ImageView) rootView.findViewById(R.id.albumArt);
queuerv = (RecyclerView) rootView.findViewById(R.id.commonrv);
favButton = (ImageButton) rootView.findViewById(R.id.action_favorite);
moreMenu = (ImageButton) rootView.findViewById(R.id.menu_button);
shuffleButton = (ImageView) rootView.findViewById(R.id.shuffle_song);
repeatButton = (ImageView) rootView.findViewById(R.id.repeat_song);
playpausebutton = (ImageView) rootView.findViewById(R.id.play_pause_toggle);
next = (ImageView) rootView.findViewById(R.id.next);
prev = (ImageView) rootView.findViewById(R.id.prev);
currentDur = (TextView) rootView.findViewById(R.id.currentDur);
totalDur = (TextView) rootView.findViewById(R.id.totalDur);
songArtist = (TextView) rootView.findViewById(R.id.song_artist);
songTitle = (TextView) rootView.findViewById(R.id.song_title);
seekbar = (SeekBar) rootView.findViewById(R.id.seekbar);
lrcView = (TextView) rootView.findViewById(R.id.lyrics);
bottomsheetLyrics = (FrameLayout) rootView.findViewById(R.id.bottomsheetLyrics);
bottomSheetBehavior = BottomSheetBehavior.from(bottomsheetLyrics);
diagonalLayout = (DiagonalLayout) rootView.findViewById(R.id.diagonalLayout);
}
示例3: onCreateDialog
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
View view = View.inflate(getContext(), R.layout.dialog_bottom_sheet, null);
dialog.setContentView(view);
mBehavior = BottomSheetBehavior.from((View) view.getParent());
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
imPay = (ImageView) view.findViewById(R.id.im_pay);
return dialog;
}
示例4: updateUI
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void updateUI() {
editText.setBackgroundColor(ContextCompat.getColor(getApplicationContext(),android.R.color.transparent));
mBehavior = BottomSheetBehavior.from(new BottomSheetBuilder(this, coordinatorLayout)
.setMode(BottomSheetBuilder.MODE_GRID)
.setBackgroundColorResource(R.color.colorDarkKnight)
.setItemTextColorResource(R.color.white)
.setMenu(R.menu.menu_attachments)
.setItemClickListener(this).createView());
mBehavior.setBottomSheetCallback(null);
toggleModes();
}
示例5: initiateTheScreenTextAndAnimation
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void initiateTheScreenTextAndAnimation() {
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
vibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
chanceFromPreference = presenter.LoadBadgeCountFromInteractor();
//check if there is any chance and show the user how many time s/he can try.
//I don't like "else{}"s :)
if(chanceFromPreference >0) chanceCounterTV.setText(" فرصتهای باقی مانده: "+"\n"+ chanceFromPreference);
if(chanceFromPreference <=0) chanceCounterTV.setText("فرصت های شما تمام شده :(");
//Adding an animation as a button with lottie
lAnimation.setAnimation("refresh.json");
//shitty setting for bad animation
lAnimation.setProgress(1);
}
示例6: onCreateDialog
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
View view = View.inflate(getActivity(), R.layout.bottom_sheet_video_list, null);
TextView textView = (TextView) view.findViewById(R.id.item_link);
textView.setText(videoUrl);
textView.setOnClickListener(this);
view.findViewById(R.id.item_copy).setOnClickListener(this);
dialog.setContentView(view);
behavior = BottomSheetBehavior.from((View) view.getParent());
return dialog;
}
示例7: setUpBotomSheet
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private void setUpBotomSheet() {
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
//initially set hidden(in case there are no pharmacies around).Not working
mBottomSheetBehavior.setHideable(true);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
示例8: show
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void show() {
if (getContext().getResources().getBoolean(R.bool.is_tablet)) {
final int peekHeight = getContext().getResources().getDimensionPixelSize(R.dimen.tablet_bottom_sheet_peekheight);
BottomSheetBehavior<View> bsBehaviour = BottomSheetBehavior.from((View) contentView.getParent());
bsBehaviour.setPeekHeight(peekHeight);
}
super.show();
}
示例9: onCreate
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_boxing_bottom_sheet);
createToolbar();
FrameLayout bottomSheet = (FrameLayout) findViewById(R.id.content_layout);
mBehavior = BottomSheetBehavior.from(bottomSheet);
mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
mImage = (ImageView) findViewById(R.id.media_result);
mImage.setOnClickListener(this);
}
示例10: initView
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private void initView() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
btnBottomSheetControl = (Button) findViewById(R.id.btn_bottom_sheet_control);
btnBottomDialogControl = (Button) findViewById(R.id.btn_bottom_dialog_control);
mBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.tab_layout));
initListener();
initDialog();
}
示例11: onCreate
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_zhihu);
initToolbar();
initData();
initView();
initListener();
FooterBehavior footerBehavior = FooterBehavior.from(fab);
footerBehavior.setOnStateChangedListener(onStateChangedListener);
mBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.tab_layout));
}
示例12: onCreateDialog
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
View view = View.inflate(getContext(), R.layout.dialog_bottom_sheet1, null);
dialog.setContentView(view);
mBehavior = BottomSheetBehavior.from((View) view.getParent());
return dialog;
}
示例13: initView
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void initView() {
setOnClickListener(this, R.id.btnBehavior, R.id.btnDialog,R.id.btn_baidumap);
View bottomSheet = findViewById(R.id.bottom_sheet);
if (bottomSheet != null) {
behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
示例14: onCreate
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bottom_sheet_activity);
setOnClickListener(this, R.id.btnBehavior, R.id.btnDialog);
View bottomSheet = findViewById(R.id.bottom_sheet);
if (bottomSheet != null) {
behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
示例15: getDefaultBottomSheetBehaviour
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private BottomSheetBehavior getDefaultBottomSheetBehaviour(View bottomSheetView) {
BottomSheetBehavior behavior = BottomSheetBehavior.from((View) bottomSheetView.getParent());
behavior.setPeekHeight(getContext().getResources().getDisplayMetrics().heightPixels/3);
return behavior;
}