Dan*_*den 2 android listview textview relativelayout imageview
我在使用XML创建相对布局时遇到问题,列表项用于ListView中的一系列项目.我已经尝试了好几个小时,我试图让它看起来像我想要的但是不能让所有东西出现在正确的位置而不是重叠或错位.我可以获得第一个图像和下两个textview,但无法获得最后的textview和imageview.
我附上了一个线框样式的图像,说明我是如何尝试它的,并且想知道是否有人可以帮助我?
替代文字http://i26.tinypic.com/6fz702.jpg
如果有人可以提供一些帮助,我将非常感激.
干杯伙计们
Dan*_*den 12
对于任何有兴趣的人,我设法让这个工作.我知道寻找问题的答案是多么痛苦,而且从未完全解决过.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/Icon"
android:layout_margin="5dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/topLine"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:lines="1"
android:layout_toRightOf="@+id/Icon"
android:layout_toLeftOf="@+id/distance"
android:textColor="@color/blacktext"
android:textSize="20dip"
android:text="Name" />
<TextView
android:id="@+id/bottomLine"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:lines="1"
android:layout_toRightOf="@+id/Icon"
android:layout_below="@+id/topLine"
android:layout_toLeftOf="@+id/distance"
android:textColor="@color/blacktext"
android:textSize="15dip"
android:text="Address" />
<TextView
android:id="@+id/distance"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/arrow"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:lines="1"
android:textColor="@color/blacktext"
android:textSize="12dip"
android:text="100m" />
<ImageView
android:id="@+id/arrow"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="5dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/redarrow"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5828 次 |
| 最近记录: |