相关疑难解决方法(0)

Android"Top Sheet"相当于"Bottom Sheet"?

我想要实现一种"Bottom Sheet"类型的布局,但有一个扭曲,其中"底部"工作表将是一个MapFragment,它不能很好地作为向上/向下可拖动视图.

我有一个天真的想法是将逻辑"翻转"到"Top Sheet"设计,你可以向上/向下拖动Top Sheet以显示更多/更少的底部MapFragment.

即:从这......
底板示例

......到[类似]这......
顶页示例

这有可能是支持设计工具,还是我必须自己滚动这样的东西?

android bottom-sheet

12
推荐指数
2
解决办法
9379
查看次数

如何让bottomSheet从顶部打开?

我正在我的应用程序中打开一个NestedScrollView,到目前为止它从屏幕底部打开.如何从顶部打开它?

我尝试删除以下行:

app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
Run Code Online (Sandbox Code Playgroud)

但该应用程序崩溃时出现以下错误:

The view is not associated with BottomSheetBehavior
Run Code Online (Sandbox Code Playgroud)

有没有办法从屏幕顶部打开底部工作表?

这是我的活动:

ViewPager mainViewPager;
private BottomSheetBehavior mBottomSheetBehavior;
int switcher = 1;
View menuPopupView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.workorder_selection_layout_with_fragment);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ...
    ....
    ...


    filterButton = (Button)       
    findViewById(R.id.filterButtonMainWorkorderSelection);
    filterButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (switcher == 1) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                switcher = 2;
            } else {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                switcher = 1;
            }


        }
    });

    ///////////////////////////////////////////
    //////////////Buttom Sheet/////////////////
    ///////////////////////////////////////////

    View bottomSheet = …
Run Code Online (Sandbox Code Playgroud)

android view bottom-sheet

8
推荐指数
1
解决办法
3610
查看次数

标签 统计

android ×2

bottom-sheet ×2

view ×1