我有一个列表视图下面的LinearLayout的问题。我试图给上面的listview权重和布局,将layout_height设置为0dp,但没有任何变化。ListView下面的线性布局,有些部分不可见?
这里是我的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="100"
android:background="#00c4ff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Application № - "
android:layout_weight="50"/>
<TextView
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="__"
android:layout_weight="20" />
<EditText
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:hint="dd/mm/yyyy"
android:layout_weight="30"
/>
</LinearLayout>
<ListView
android:id="@+id/lvMain"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom"
android:id="@+id/ll">
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/comment"
android:inputType="text"
android:hint="Comment" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom">
<Button
android:id="@+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send" />
<Button
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save and close"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
时的ListView填满整个屏幕,我看不到下面给它的按钮。
还请解释你是如何解决这个问题的。只有代码答案没有帮助。 – Doomsknight
方法布局 - 权重和权重总和是解决这个问题的方法。但在提出这样的问题之前请尝试,并且不要问这样的直接问题 –
哦,你是个天才,非常感谢你 – Sanzhar