本文整理汇总了Java中android.support.design.widget.BottomSheetBehavior.setState方法的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetBehavior.setState方法的具体用法?Java BottomSheetBehavior.setState怎么用?Java BottomSheetBehavior.setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.BottomSheetBehavior
的用法示例。
在下文中一共展示了BottomSheetBehavior.setState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: showFragment
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private void showFragment() {
if (mInsideBottomSheet != null) {
BottomSheetBehavior behavior = BottomSheetBehavior.from(mInsideBottomSheet);
if (behavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
}
}
示例3: onClick
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.print_jpeg: print(PRINT_JPEG); break;
case R.id.print_pdf: print(PRINT_PDF); break;
case R.id.print_png: print(PRINT_PNG); break;
case R.id.edit:
BottomSheetBehavior b = BottomSheetBehavior.from(mPanel);
b.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
case R.id.logo_prompt:
startActivity(new Intent(this, LogoActivity.class));
break;
}
}
示例4: onBackPressed
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
BottomSheetBehavior b = BottomSheetBehavior.from(mPanel);
if (b.getState() != BottomSheetBehavior.STATE_HIDDEN) {
b.setState(BottomSheetBehavior.STATE_HIDDEN);
return;
}
super.onBackPressed();
}
示例5: onPositive
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onPositive(BottomSheetBehavior sheetBehavior, String result) {
if(isAlive()) {
if (original == null)
original = result;
else
original += result;
editText.setText(original);
sheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
}
示例6: setupDialog
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
Bundle bundle = getArguments();
pos = bundle.getInt("pos");
bean = (AppBean) bundle.getSerializable("bean");
contentView = View.inflate(getContext(), R.layout.fragment_req_menu, null);
dialog.setContentView(contentView);
((TextView) contentView.findViewById(R.id.tv_title)).setText(bean.getLabel());
if (bean.isMark()) {
contentView.findViewById(R.id.view_menu_mark).setVisibility(View.GONE);
contentView.findViewById(R.id.view_menu_undo_mark).setOnClickListener(this);
contentView.findViewById(R.id.view_hint_undo_mark)
.setVisibility(bean.isHintUndoMark() ? View.VISIBLE : View.GONE);
} else {
contentView.findViewById(R.id.view_menu_undo_mark).setVisibility(View.GONE);
contentView.findViewById(R.id.view_menu_mark).setOnClickListener(this);
contentView.findViewById(R.id.view_hint_mark)
.setVisibility(bean.isHintMark() ? View.VISIBLE : View.GONE);
}
contentView.findViewById(R.id.view_hint_lost)
.setVisibility(bean.isHintLost() ? View.VISIBLE : View.GONE);
contentView.findViewById(R.id.view_menu_goto_market).setOnClickListener(this);
contentView.findViewById(R.id.view_menu_copy_code).setOnClickListener(this);
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior
.from((View) contentView.getParent());
if (bean.isHintLost()) {
// In landscape, STATE_EXPANDED doesn't make sheet expanded.
// Maybe it's a bug. So do this to fix it.
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
contentView.measure(0, 0);
bottomSheetBehavior.setPeekHeight(contentView.getMeasuredHeight());
}
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
bottomSheetBehavior.setPeekHeight(getResources()
.getDimensionPixelSize(R.dimen.req_bottom_menu_height));
}
}
示例7: onCreate
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_devices);
unbinder = ButterKnife.bind(this);
adapter = new DevicesAdapter(this, this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMapAsync(googleMap -> {
this.googleMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
googleMap.setMyLocationEnabled(true);
}
if (currentDevices != null) {
showMarkers();
}
});
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
View.OnClickListener expandClick = v -> behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
textTotal.setOnClickListener(expandClick);
imageSwipeUp.setOnClickListener(expandClick);
}
示例8: onNegative
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onNegative(BottomSheetBehavior sheetBehavior) {
sheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}