Android Listview赢得';与父母不匹配
以下是XML:Android Listview赢得';与父母不匹配,android,listview,Android,Listview,以下是XML: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffa500" android:orientati
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffa500"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/profile_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/essai_profil" />
<Button
android:id="@+id/portrait_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/icon_portrait" />
<Button
android:id="@+id/education_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/education_icon" />
<Button
android:id="@+id/skills_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/skill_icon" />
<Button
android:id="@+id/langue_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/map_icon" />
<Button
android:id="@+id/loisir_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/dice" />
<Button
android:id="@+id/contact_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/contact_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="50dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/bubble_1"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start" />
<Button
android:id="@+id/bubble_2"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
<Button
android:id="@+id/bubble_3"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
<Button
android:id="@+id/bubble_4"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
<Button
android:id="@+id/bubble_5"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
<Button
android:id="@+id/bubble_6"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
<Button
android:id="@+id/bubble_7"
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="@drawable/bubble_start"
android:visibility="invisible" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bubble_patched" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="@string/name"
android:textColor="#996300"
android:textSize="20sp"
android:textStyle="bold" />
<ListView
android:id="@+id/lv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/title" >
</ListView>
</RelativeLayout>
listview仅占线性布局剩余高度的四分之一左右
作为一种体验,我试着单独使用它(删除textview和线性布局),并且它按照预期进行了拉伸
可能很愚蠢,但无法理解 根布局中必须有一些填充或其他内容,否则在我的布局中似乎可以:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DynamicListView" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="name"
android:textColor="#996300"
android:textSize="20sp"
android:textStyle="bold" />
<ListView
android:id="@+id/lv_content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
</RelativeLayout>
你有很多
按钮和android:layout\u height=“100dp”
,它们占据了你视野中的所有高度。
14高度为100dp=高度为1400dp的按钮。您还有一个边距顶部,可以增加视图的高度。在列表视图中添加项目
默认情况下,它将增加并滚动,并使其环绕内容
你到底有什么问题?问题不太清楚。都是关于线性布局“bubble\u patched”的背景。不知怎的,它在修补的部分被切断了。。。刚回到一个没有补丁的背景作为解决方案
谢谢大家使用相对布局您的文本视图的文本是什么?您还有其他外部布局吗?giacomoni->我的名字很短!Raghundandan->我刚刚试过,同样的行为我把整个代码都放了出来,对此我很抱歉。这不应该麻烦,因为这些按钮是根线性布局的前两列,listview在第三列,你的屏幕大小是多少?800x1280是屏幕大小对你来说是android:layout\u alignParentTop=“true”textview和android:layout\u=“@id/title“到你的ListView还没有。。。这是一个奇怪的问题我的问题是listview不会一直到父视图的底部。。。无论内部是什么。添加垂直于父线性布局的方向。您是指根线性布局吗?我发现它不见了,我加了上去,但还是一样。顺便说一下,我把它设为水平