-1

我的Scrollview留下一些空間layoutsScrollView在佈局活動的底部留下額外空間 - android

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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="#efefef"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     style="@style/CustomToolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?actionBarSize" 
     android:layout_alignParentTop="true"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <com.joanzapata.iconify.widget.IconButton 
       android:id="@+id/back_iconbutton" 
       style="@style/ToolbarButton" 
       android:layout_alignParentRight="true" 
       android:text="@string/icon_material_arrow_forward" 
       android:textSize="24sp" /> 

      <TextView 
       android:id="@+id/toolbar_title_textview" 
       fontPath="@string/bold_font_path" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_toLeftOf="@id/back_iconbutton" 
       android:textAppearance="?android:textAppearanceMedium" 
       android:textColor="@color/colorTextLight" /> 

     </RelativeLayout> 

    </android.support.v7.widget.Toolbar> 

    <com.github.rahatarmanahmed.cpv.CircularProgressView 
     android:id="@+id/order_loading_progress_circularprogressview" 
     android:layout_width="@dimen/circular_progress_width" 
     android:layout_height="@dimen/circular_progress_width" 
     android:layout_centerInParent="true" 
     app:cpv_animAutostart="true" 
     app:cpv_color="@color/colorPrimaryDark" 
     app:cpv_indeterminate="true" /> 

    <ScrollView 
     android:id="@+id/order_activity_content_scrollview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/toolbar" 
     android:fillViewport="true"> 

     <android.support.constraint.ConstraintLayout 
      android:id="@+id/order_activity_content_constraintlayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <RelativeLayout 
       android:id="@+id/status_send_relative" 
       android:layout_width="0dp" 
       android:layout_height="50dp" 
       android:layout_marginEnd="16dp" 
       android:layout_marginLeft="16dp" 
       android:layout_marginRight="16dp" 
       android:layout_marginStart="16dp" 
       app:layout_constraintBottom_toTopOf="@+id/ordered_products_list_recyclerview" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toTopOf="parent"> 

       <Switch 
        android:id="@+id/status_send_switch" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="10dp" 
        android:gravity="center_vertical" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="5dp" 
        android:layout_toRightOf="@+id/status_send_switch" 
        android:gravity="center_vertical" 
        android:text="@string/not_send" /> 
      </RelativeLayout> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/ordered_products_list_recyclerview" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_marginEnd="16dp" 
       android:layout_marginLeft="16dp" 
       android:layout_marginRight="16dp" 
       android:layout_marginStart="16dp" 
       android:layout_marginTop="8dp" 
       app:layout_constraintBottom_toTopOf="@+id/personal_profile_cardview" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toBottomOf="@+id/status_send_relative" /> 

      <android.support.v7.widget.CardView 
       android:id="@+id/personal_profile_cardview" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="16dp" 
       android:layout_marginRight="16dp" 
       android:layout_marginTop="8dp" 
       app:layout_constraintBottom_toTopOf="@+id/sum_bills_cardview" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toBottomOf="@+id/ordered_products_list_recyclerview"> 

       <android.support.constraint.ConstraintLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:layout_marginBottom="16dp" 
        android:layout_marginTop="16dp"> 

        <com.joanzapata.iconify.widget.IconButton 
         android:id="@+id/person_iconbutton" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:background="@null" 
         android:text="@string/md_person" 
         app:layout_constraintHorizontal_weight="1" 
         app:layout_constraintLeft_toRightOf="@+id/name_textview" 
         app:layout_constraintRight_toRightOf="parent" 
         app:layout_constraintTop_toTopOf="parent" /> 

        <TextView 
         android:id="@+id/name_textview" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:gravity="right" 
         android:text="حسن الماسی" 
         app:layout_constraintBaseline_toBaselineOf="@+id/person_iconbutton" 
         app:layout_constraintHorizontal_weight="5" 
         app:layout_constraintLeft_toLeftOf="parent" 
         app:layout_constraintRight_toLeftOf="@+id/person_iconbutton" 
         app:layout_constraintTop_toTopOf="parent" /> 


        <com.joanzapata.iconify.widget.IconButton 
         android:id="@+id/date_iconbutton" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:background="@null" 
         android:text="@string/icon_fa_date" 
         app:layout_constraintHorizontal_weight="1" 
         app:layout_constraintLeft_toRightOf="@+id/date_textview" 
         app:layout_constraintRight_toRightOf="parent" 
         app:layout_constraintTop_toBottomOf="@+id/person_iconbutton" /> 

        <TextView 
         android:id="@+id/date_textview" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:gravity="right" 
         android:text="1254862268522655" 
         app:layout_constraintBaseline_toBaselineOf="@+id/date_iconbutton" 
         app:layout_constraintHorizontal_weight="5" 
         app:layout_constraintLeft_toLeftOf="parent" 
         app:layout_constraintRight_toLeftOf="@+id/date_iconbutton" 
         app:layout_constraintRight_toRightOf="@+id/name_textview" 
         app:layout_constraintTop_toBottomOf="@+id/name_textview" /> 

        <com.joanzapata.iconify.widget.IconButton 
         android:id="@+id/location_iconbutton" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:background="@null" 
         android:text="@string/icon_material_location_on" 
         app:layout_constraintHorizontal_weight="1" 
         app:layout_constraintLeft_toRightOf="@+id/location_textview" 
         app:layout_constraintRight_toRightOf="parent" 
         app:layout_constraintTop_toBottomOf="@+id/date_iconbutton" /> 

        <TextView 
         android:id="@+id/location_textview" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:gravity="right" 
         android:text="111 پردیسان پردیسان پردیسان پردیسان پردیسان پردیسان پردیسان پردیسان پردیسان پردیسانپردیسان پردیسان پردیسان پردیسان پردیسان پردیسان پردیسان 222" 
         app:layout_constraintBaseline_toBaselineOf="@+id/location_iconbutton" 
         app:layout_constraintBottom_toBottomOf="parent" 
         app:layout_constraintHorizontal_weight="5" 
         app:layout_constraintLeft_toLeftOf="parent" 
         app:layout_constraintRight_toRightOf="@+id/date_textview" 
         app:layout_constraintTop_toBottomOf="@+id/date_textview" /> 

       </android.support.constraint.ConstraintLayout> 

      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       android:id="@+id/sum_bills_cardview" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="16dp" 
       android:layout_marginRight="16dp" 
       android:layout_marginTop="8dp" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toBottomOf="@+id/personal_profile_cardview"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginBottom="16dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_marginTop="16dp" 
        android:weightSum="2"> 

        <TextView 
         android:id="@+id/title_sum_bills_textview" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:text="50000000" /> 

        <TextView 
         android:id="@+id/value_sum_bills_textview" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:text="@string/sum_bills" /> 

       </LinearLayout> 
      </android.support.v7.widget.CardView> 
     </android.support.constraint.ConstraintLayout> 

    </ScrollView> 
</RelativeLayout> 
+1

您可以提供屏幕截圖的空間,請刪除上面的行! –

+0

提供這些「一些」佈局的ID和截圖 – sHOLE

+0

我有大空間波紋管佈局。 –

回答

1
  1. RelativeLayoutConstraintLayout下有android:layout_marginEnd="16dp"
  2. RecyclerViewRelativeLayout關閉後,有android:layout_marginEnd="16dp"
  3. ConstraintLayoutCardViewandroid:layout_marginBottom="16dp"
  4. LinearLayout最後CardView內部有android:layout_marginBottom="16dp"

嘗試改變它們或刪除它們&看它是否工作。在我看來,刪除這4個參數應該可以工作。

1

您在您的RelativeLayout下面的ConstraintLayout中使用了Margin。

android:layout_marginEnd="16dp" 
android:layout_marginLeft="16dp" 
android:layout_marginRight="16dp" 
android:layout_marginStart="16dp" 

嘗試從

<RelativeLayout 
      android:id="@+id/status_send_relative" 
      android:layout_width="0dp" 
      android:layout_height="50dp" 
      android:layout_marginEnd="16dp" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginStart="16dp" 
      app:layout_constraintBottom_toTopOf="@+id/ordered_products_list_recyclerview" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toTopOf="parent"> 
相關問題