ListView怎么样横向显示内容

云鹏 2012-03-09 11:37:09
这是我的ListView的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<TextView android:id="@+id/message"
android:gravity="bottom|center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="20px"
android:layout_margin="10dp"
android:background="@drawable/showback"/>
</LinearLayout>


<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ListView
android:id="@+id/ShowList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
></ListView>
</LinearLayout>
</HorizontalScrollView>

求指教
...全文
799 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qinjuning 2012-03-09
  • 打赏
  • 举报
回复
ListView设计意图就是列显示的 ,

你可以自己实现一个控件去横向显示 , 网上去搜搜吧 。
云鹏 2012-03-09
  • 打赏
  • 举报
回复
额,你这样写的话不用ListView 都可以
licaiyuren 2012-03-09
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 licaiyuren 的回复:]

<ListView
android:id="@+id/ShowList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
>

<RelativeLayout
........
......>
……
[/Quote]

不对,没有注意整体结构,应该新建一个XML,就是ListView的布局listViewXML.xml
然后把上边补充的添加进去

<RelativeLayout
........
......>
<TextView
....../>
<TextView
....../>
<TextView
....../>

</RelativeLayout>
然后就可以再你的ListView的适配器中getView()进行处理显示
licaiyuren 2012-03-09
  • 打赏
  • 举报
回复
<ListView
android:id="@+id/ShowList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
>

<RelativeLayout
........
......>
<TextView
....../>
<TextView
....../>
<TextView
....../>

</RelativeLayout>


</ListView>

在TextView里边添加文本就可以 啊

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧