相关疑难解决方法(0)

如何使用新的设计支持库23.2实现底部表格

谷歌发布了支持库23.2的新更新,因为他们添加了底页功能.任何人都可以告诉如何使用该库实现该底部工作表.

android android-support-library android-support-design

32
推荐指数
3
解决办法
4万
查看次数

如何禁用BottomSheetDialogFragment拖动

如何禁用BottomSheetDialogFragment手指拖动?

我看到了类似的问题,但他们BottomSheet都不是BottomSheetDialogFragment.

android android-layout android-view android-dialog bottom-sheet

13
推荐指数
7
解决办法
8418
查看次数

仅在按钮点击时才需要显示底部表格行为?

我已经使用appcompat-v7实现了底页:23.2.1.一切正常,但唯一的问题是,当我向上拖动布局时,底部工作表出现.我不希望在向上拖动时显示底部工作表在底部工作表未显示在屏幕上时的布局上.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/DarkGray"
tools:context=".bottom_sheets.grid.BottomSheetGridActivity">
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <Button
        android:id="@+id/btnView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Show view" />
  </LinearLayout>
   <LinearLayout
    android:id="@+id/bottom_sheet1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical"
    android:layout_marginBottom="8dp"
    app:layout_behavior="@string/bottom_sheet_behavior">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:background="#fff"
        />
 </LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

主要活动

  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bottom_grid);
    Button btnView = (Button) findViewById(R.id.btnView);
    View bottomSheet = findViewById(R.id.bottom_sheet1);
    behavior = BottomSheetBehavior.from(bottomSheet);
    btnView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

             behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    });

    behavior.setBottomSheetCallback(new …
Run Code Online (Sandbox Code Playgroud)

android bottom-sheet

5
推荐指数
1
解决办法
9971
查看次数

禁用BottomSheet拖动

由于我的声誉点很低,我无法发表评论。所以我要扩展这个问题: 禁用用户在BottomSheet上拖动

Ray W 提供的解决方案有效,但现在它通过在父视图(CoordinatorLayout)上滑动和拖动来扩展。

图片

在该图像中,如果我拖动“不需要的拖动区域”,BottomSheet 会向上滑动。如何过滤或停止不需要的视图上的触摸事件?

android android-support-library android-support-design bottom-sheet

5
推荐指数
2
解决办法
1万
查看次数

使用Bottom Sheet Android滚动问题

我需要将底页停在两个位置.我有底部表格的以下代码.

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        ....
    </RelativeLayout>

    <FrameLayout
        android:id="@+id/bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
           <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:minHeight="1000dp"
                    android:orientation="vertical">
                    ....
                </LinearLayout>
          </ScrollView>
     </FrameLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

View bottomSheet = coordinatorLayout.findViewById(R.id.bottom_sheet);
        final BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
        behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
            @Override
            public void onStateChanged(@NonNull View bottomSheet, int newState) {
                // React to state change
                Log.e("onStateChanged", "onStateChanged:" + newState);
                if (newState == BottomSheetBehavior.STATE_EXPANDED) {
                    behavior.setPeekHeight(600);
                    showAgain.setVisibility(View.GONE);
                    mMap.getUiSettings().setScrollGesturesEnabled(false);
                } else if (newState == BottomSheetBehavior.STATE_COLLAPSED) {

                    if …
Run Code Online (Sandbox Code Playgroud)

java android bottom-sheet

5
推荐指数
2
解决办法
3691
查看次数

禁用带有可滚动子项的BottomSheetDialogFragment的拖动

是否可以禁用对BottomSheetDialogFragment包含可滚动视图(例如a ViewPager或a)的a的NestedScrollView拖动,以使其既不能向上或向下拖动,但仍可以通过触摸外部而关闭,并且无论如何都可以拖动子级?

我在这里查看了所有答案但我不满意,因为大多数人没有考虑可滚动的子项或通过强制展开状态来工作。最接近的是这个答案,但是仍然允许将工作表向上拖动。

在我应修改原始源代码方面,是否有任何解决方案或至少是指南?

android bottom-sheet

4
推荐指数
1
解决办法
2424
查看次数