gpt4 book ai didi

java - 删除android中底部布局和 ScrollView 之间的空格

转载 作者:行者123 更新时间:2023-12-01 04:56:11 24 4
gpt4 key购买 nike

enter image description here

下面是xml代码....

friend 们帮我看看如何避免scrollview和bottomLayout之间有空格

XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/addNewEventsCommonbg" >

<TextView
android:id="@+id/addNewEventsTitle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentTop="true"
android:background="@drawable/dialog_title_bg"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEvents"
android:textColor="@color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />

<TextView
android:id="@+id/addNewEventsTitleName"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_below="@+id/addNewEventsTitle"
android:background="@color/addNewEventsTitleNamebg"
android:drawableLeft="@drawable/mail_sent_icon"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEvent"
android:textColor="@color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomLayout"
android:layout_below="@+id/addNewEventsTitleName" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/addNewEventsEventLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEvent"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsName"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsDateTimeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/addNewEventsDate"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<TextView
android:id="@+id/addNewEventsDate"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="@drawable/wedding_date_bg"
android:gravity="center"
android:text="@string/setDate"
android:textColor="@color/whiteColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="@string/AddNewEventsTime"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<TextView
android:id="@+id/addNewEventsTime"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="@drawable/wedding_date_bg"
android:gravity="center"
android:text="@string/setTime"
android:textColor="@color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsAddressLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="@string/address"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsAddress"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsAddressHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textPostalAddress"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsContactLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEventContact"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsContacts"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsPhoneFaxLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:baselineAligned="false"
android:orientation="horizontal" >

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEventsPhone"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsPhone"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:inputType="phone"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="@string/AddNewEventsFax"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsFax"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:inputType="text|phone"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsEmailLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/email"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsEmail"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEmailAddress"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<LinearLayout
android:id="@+id/addNewEventsWebsiteLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >

<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="@string/AddNewEventsWebsite"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />

<EditText
android:id="@+id/addNewEventsWebsite"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEditText"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>

<EditText
android:id="@+id/AddNewEventsComments"
style="@style/edittext_style"
android:layout_width="match_parent"
android:layout_height="@dimen/AddNewEventsCommentsHeight"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="@dimen/AddNewEventsTopMargin"
android:gravity="left"
android:inputType="textMultiLine"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="@color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>

<LinearLayout
android:id="@+id/bottomLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >

<Button
android:id="@+id/addNewEventsCancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/cancel_btn_selector"
android:text="@string/cancel"
android:textColor="@color/whiteColor"
android:textSize="18sp" />

<Button
android:id="@+id/addNewEventsSaveBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@drawable/save_btn_selector"
android:text="@string/save"
android:textColor="@color/whiteColor"
android:textSize="18sp" />
</LinearLayout>

</RelativeLayout>

最佳答案

   <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"// Gained the whole vertical space
android:layout_weight="1" // Adding weight makes another layout fix and adjustable after these
android:layout_above="@+id/bottomLayout"
android:layout_below="@+id/addNewEventsTitleName" >

希望这些可能有效!

关于java - 删除android中底部布局和 ScrollView 之间的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14102285/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com