当前位置: 首页>>代码示例>>Java>>正文


Java BottomSheetBehavior.setState方法代码示例

本文整理汇总了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;

        }
    }
 
开发者ID:enricocid,项目名称:Gallery-example,代码行数:20,代码来源:BottomSheetMediaActions.java

示例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);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:SecondActivity.java

示例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;
    }
}
 
开发者ID:natario1,项目名称:ViewPrinter,代码行数:16,代码来源:MainActivity.java

示例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();
}
 
开发者ID:natario1,项目名称:ViewPrinter,代码行数:10,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:12,代码来源:ComposerActivity.java

示例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));
    }
}
 
开发者ID:by-syk,项目名称:NanoIconPack,代码行数:44,代码来源:ReqMenuDialog.java

示例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);
}
 
开发者ID:drfonfon,项目名称:ITagAntiLost,代码行数:31,代码来源:DevicesActivity.java

示例8: onNegative

import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onNegative(BottomSheetBehavior sheetBehavior) {
    sheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:5,代码来源:ComposerActivity.java


注:本文中的android.support.design.widget.BottomSheetBehavior.setState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。