我想显示我的组视图,向下显示 2 行,但只显示一行:
我有 Linear_group.xml 的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/primerIcono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:src="@drawable/img_transparente"
android:visibility="visible" />
<ImageView
android:id="@+id/segundoIcono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:src="@drawable/img_transparente"
android:visibility="visible" />
</LinearLayout>
<TextView
android:id="@+id/tvRowCodigo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:singleLine="true"
android:text="12345"
android:textSize="12dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_weight="3"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="@+id/tvRowDireccion"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvRowGremio"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvRowFechaCad"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
第 3 个图像视图是图标,但接下来的文本视图我想在更多行中显示,但只显示第一个。我附上屏幕截图
编辑:
expandablelistview 不向我显示所有文本视图,第二个和第三个文本视图是“direction del servicio”和 gremio del estudiandte y profesion”,但只向我显示 direccion del 和 gremio del。我想显示其余的第二行
好吧,问题的描述有点难以阅读,但我会尽力为您指出正确的方向。我假设您正在尝试在单独的行上列出职业、方向和日期 TextView。
尝试更改 xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" > <-make this one vertical
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/primerIcono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:src="@drawable/img_transparente"
android:visibility="visible" />
<ImageView
android:id="@+id/segundoIcono"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:src="@drawable/img_transparente"
android:visibility="visible" />
</LinearLayout>
<TextView
android:id="@+id/tvRowCodigo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:singleLine="true"
android:text="12345"
android:textSize="12dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_weight="3"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="@+id/tvRowDireccion"
android:layout_width="fill_parent"
android:layout_height="wrap_content" <- instead of fill_parent
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvRowGremio"
android:layout_width="fill_parent"
android:layout_height="wrap_content" <- instead of fill_parent
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvRowFechaCad"
android:layout_width="fill_parent"
android:layout_height="wrap_content" <- instead of fill_parent
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
您需要更改 XML 以使用水平和垂直 LinearLayout 标注。基本上,您创建一个包含两个水平 LinearLayout 的垂直 LinearLayout。
像这样的伪代码:
<LinearLayout Vertical>
<LinearLayout Horizontal> (row 1)
Widgets for Row 1
</LinearLayout>
<LinearLayout Horizontal> (row 2)
Widgets for Row 2
</LinearLayout>
</LinerLayout>