當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。