android - 可扩展 ListView 组中的 2 行

标签 android expandablelistview

我想用 2 行向下显示我的组 View ,但只显示一行:

我有 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 个 ImageView 是图标,但接下来的 TextView 是我想在更多行中显示的,但只显示第一个。我附上截图 http://desmond.imageshack.us/Himg846/scaled.php?server=846&filename=fotonl.png&res=landing

编辑:

expandablelistview 不显示所有的 textview,第二个和第三个 textview 是“direccion del servicio”和 gremio del estudiandte y profesion”但只显示方向del and gremio del. 我想在第二行显示 te rest

最佳答案

好吧,问题的描述有点难以阅读,但我会尽力为您指明正确的方向。我假设您正在尝试在单独的行中列出职业、方向和日期 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> 

关于android - 可扩展 ListView 组中的 2 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11014852/

相关文章:

Android Studio 3.5.2 - Marketplace 插件未加载

java - 如何将 ISO 8601 句点转换为人类可读的字符串 [Android Studio]?

java - 需要 Android 堆按摩

来自在线数据库的android可扩展列表

android - 如何为 ExpandableListView 设置组分隔线颜色

android - 重复通知设置静音时间

java - 安卓|如何在 ScrollView 中使用 ExpandableListView?

android - 保存和恢复 ExpandableListActivity 的展开/折叠状态

android - 如何删除 ExpandableListView 中特定组(行)的箭头

android - 单击联系人图标后,将自己的应用程序图标添加到 QuickAction Dialog