Мой макет съедает последнее изображение - PullRequest
0 голосов
/ 11 июля 2011

У меня есть этот макет для моей строки в виде списка ... последнее изображение не отображается ... почему?

<?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="70dip"
    android:background="@android:color/black">

    <ImageView
        android:id="@+id/img"
        android:layout_width="60dip"
        android:layout_height="60dip"
        android:layout_gravity="center"
        android:layout_marginLeft="5dip"/>

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

            <TextView android:id="@+id/title"         
                android:textSize="14sp"         
                android:textStyle="bold" 
                android:textColor="#FFFFFF"        
                android:layout_width="fill_parent"         
                android:layout_height="wrap_content"
                android:layout_weight="0" 
                android:layout_marginLeft="10dip"
                android:layout_marginTop="1dip"/>

            <TextView android:id="@+id/description"   
                android:typeface="sans"
                android:textSize="12sp"
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent"
                android:ellipsize="end"
                android:layout_weight="0"  
                android:layout_marginLeft="10dip"/>      


            <TextView android:id="@+id/variable" 
                android:textSize="12sp"      
                android:textColor="#FFFFFF"        
                android:layout_width="fill_parent"         
                android:layout_height="fill_parent"
                android:lines="1"
                android:ellipsize="end"
                android:layout_weight="0"  
                android:layout_marginLeft="10dip"/>

        </LinearLayout>

        <ImageView
            android:id="@+id/img"
            android:src="@drawable/disclosure"
            android:layout_width="60dip"
            android:layout_height="60dip"
            android:layout_gravity="center"
            android:layout_marginLeft="5dip"/>

</LinearLayout>

Заранее спасибо,

привет

Ответы [ 2 ]

1 голос
/ 11 июля 2011

РЕДАКТИРОВАТЬ: попробуйте использовать относительное расположение, чтобы вам не нужно иметь линейное расположение в середине. У меня также есть три колонки, поэтому для вас это должно быть похоже.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  android:id ="@+id/container"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="62dp" 
  android:cacheColorHint="#ff000000" 
  android:background="@color/white"
  android:clickable="true"
  >
  <ImageView
    android:layout_height="60dp"
    android:layout_width="60dp"
    android:id="@+id/thumbnail"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="1dp"
    android:layout_marginTop="1dp"
    android:layout_marginLeft="2dp"
    android:layout_centerVertical="true"
    android:scaleType="fitXY"
    />
  <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:paddingRight="10dp"
        android:layout_toRightOf="@id/thumbnail"
        android:textSize="13dp"
        android:textStyle="bold"
        android:focusableInTouchMode="true" 
        android:scrollHorizontally="true"
        android:layout_alignTop = "@id/thumbnail"/>
        <TextView
            android:id="@+id/merchant"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:paddingRight="10dp"
        android:layout_toRightOf="@id/thumbnail"
        android:textSize="12dp"
        android:textStyle="normal"
        android:textColor="#000000"
        android:ellipsize="end" 
        android:focusable="true" 
        android:lines="1" 
        android:focusableInTouchMode="true" 
        android:scrollHorizontally="true"/>
    <TextView
        android:id="@+id/distance"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_below="@id/merchant"
        android:layout_toRightOf="@id/priceButton"
        android:textColor="@color/black"
    />
    <Button
        android:id="@+id/priceButton"
        android:layout_height="60dp"
        android:layout_width="70dp"
        android:textColor="@color/white"
        android:textSize="14dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="2dp"
    />
</RelativeLayout>
0 голосов
/ 11 июля 2011

Без скриншота, я думаю, у вас слишком много данных на экране, используйте scrollview, чтобы позволить пользователю прокручивать.

Кроме того, почему высота вашего корневого макета ограничена 70? Почему вы не используете fill_parent или match_parent

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...