简体   繁体   English

如何从android的Bottom表中删除顶部填充?

[英]How to remove top padding from Bottom sheet in android?

I had tried to set padding = 0 on bottom sheet coordinator layout.我曾尝试在底部工作表协调器布局上设置 padding = 0。 How can i remove top padding from bottomsheet in android?如何从android中的bottomsheet中删除顶部填充?

在此处输入图片说明

I think I have got the answer.我想我已经得到了答案。 Just need to remove the android:fitsSystemWindows="true" from bottom_sheet ie the LinearLayout.只需要从android:fitsSystemWindows="true"删除android:fitsSystemWindows="true" ,即LinearLayout。 Just in case I am putting the xml code below.以防万一我把xml代码放在下面。

<?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:fitsSystemWindows="true"
    android:id="@+id/coordinatorLayout"
    tools:context=".MainActivity">

    <include layout="@layout/content_main" />


    <LinearLayout android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:orientation="horizontal"
        app:behavior_hideable="true"
        app:behavior_peekHeight="0dp"
        android:id="@+id/bottom_sheet"
        android:background="@android:color/holo_orange_light"
        app:layout_behavior="@string/bottom_sheet_behavior" 
        xmlns:android="http://schemas.android.com/apk/res/android">

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_photo_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_image_gallery"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_video_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_video_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />


    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

Just for my use, I have used differently drawable you need to change it back to the original one.仅供我使用,我使用了不同的 drawable,您需要将其改回原来的。

I hope it helps!我希望它有帮助!

您可以为底部工作表制作自定义视图并在其中放置空格和边距

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何删除Android复选框的内部图像填充(顶部,左侧和底部) - How to remove internal Image padding (Top, Left and Bottom) of an Android Checkbox 如何设置或删除android SearchView的顶部和底部填充? - How to set or remove android SearchView top and bottom padding? 如何从android.support.v7.widget.Toolbar中删除顶部和底部填充? - How to remove top and bottom padding from android.support.v7.widget.Toolbar? Android:TextView:删除顶部和底部的间距和填充 - Android: TextView: Remove spacing and padding on top and bottom android-如何使底部从底部到顶部 - android - How to make a bottom sheet from bottom to top 如何删除textView的顶部和底部填充? - How to remove top and bottom padding on a textView? 如何从Android WebView应用程序底部删除白色填充块? - How to remove white padding block from bottom of android webview app? 删除搜索栏中的顶部和底部填充 - Remove the top and bottom padding in a SeekBar 如何在 android 的底板顶部制作图像 - how to make image at top of bottom sheet in android 如何在Android底部工作表的顶部添加ImageView - How to add an ImageView at the top of bottom sheet in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM