The Notepad example on android developer适用于单个列表,但我希望在一个视图中从两个表中绘制两个列表。有没有人可以详述如何实现这样的东西?
我想知道我需要多少适配器。我可以在一个ListActivity中管理两个列表吗?
发布于 2011-10-05 05:14:13
为什么不在本教程中实现为Relative Layout而不是线性布局。线性布局只允许对象彼此上下排列,而相对布局允许更多自由。
使用
android:layout_toRightOf = ""
android:layout_toLeftOf = ""把东西放在一起。混合填充和间距以获得良好的效果(请注意,同时使用两者会导致崩溃,因此请确保只使用其中之一)。
此外,还有
android:layout_alignLeft
android:layout_alignRight但我正在想办法解决这个问题。
下面是我们为什么没有一些示例代码的原因
<?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"
android:id = "@+id/layout">
<TextView
android:id = "@+id/RightFrame"  
android:layout_width="wrap_content" 
android:layout_height="fill_parent" 
android:text="hello right frame"
android:layout_alignParentRight = "true"/>
<TextView
android:id = "@+id/LeftFrame"
android:layout_width="wrap_content" 
android:layout_height="fill_parent" 
android:text="hello left frame"
android:layout_alignParentLeft = "true"/>
</RelativeLayout>抱歉,如果有点乱的话
编辑:
关于列表适配器,我认为最好使用两个适配器,并在单独的框架视图中实现它们。也许研究一下fragments也是值得的,但如果你问我,他们太可怕了。
https://stackoverflow.com/questions/7653371
复制相似问题