android-如何为ListView行创建类似列的布局?

android-如何为ListView行创建类似列的布局?,第1张

概述我有一个相对的布局,看起来像这样:这是代码:<?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="fill_parent"android:layout_height=&q

我有一个相对的布局,看起来像这样:

这是代码:

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    >       <TextVIEw        androID:ID="@+ID/nameText"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:padding="5dip"        androID:layout_alignParentleft="true"        androID:text="Symbol"        />    <TextVIEw        androID:ID="@+ID/priceText"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:padding="5dip"        androID:layout_toRightOf="@+ID/nameText"        androID:gravity="right"             androID:text="100"     />      <TextVIEw        androID:ID="@+ID/changeText"        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:padding="5dip"        androID:layout_toRightOf="@+ID/priceText"        androID:gravity="right"             androID:text="1.3"        />  </relativeLayout>

如何获得在1.3号旁边排列的公司名称?

解决方法:

跟踪Mayra的答案,这是使用layout_weight做到这一点的一种方法:

<?xml version="1.0" enCoding="utf-8"?><tableLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"     >    <tableRow>          <TextVIEw            androID:ID="@+ID/left_text"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:gravity="left|center_vertical"            androID:padding="5dip"            androID:layout_weight="0"            androID:text="Code"            />        <TextVIEw            androID:ID="@+ID/mIDdle_text"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:gravity="right|center_vertical"            androID:padding="5dip"            androID:layout_weight="1"            androID:text="name of Company"            />              <TextVIEw            androID:ID="@+ID/right_text"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:padding="5dip"            androID:gravity="right|center_vertical"            androID:layout_weight="0"                   androID:text="1.3"            />    </tableRow></tableLayout>
总结

以上是内存溢出为你收集整理的android-如何为ListView行创建类似列的布局?全部内容,希望文章能够帮你解决android-如何为ListView行创建类似列的布局?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1092564.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存