开发者

My layout eats the last image

I have this layout for my row in a listview... last image is not displayed... why?

<?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:te开发者_如何学运维xtColor="#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>

Thanks in advance,

regards


EDIT: Try using a relativelayout so you don't have to have a linearlayout in the middle. I also have a three columnish thing going on so it should be similar for you.

<?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>


With no screenshot I would imagine you just have too much data on the screen , use a scrollview to allow the user to scroll.

Also why is your root layout's height limited to 70? Why dont you use fill_parent or match_parent

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜