
如图的layout设计是怎么样解决呢?
1 LinearLayout做大的布局
2 里面内嵌 LinearLayout 做水平布局放置图标和标题
3 添加 LinearLayout 水平布局放置其它信息
4 添加 LinearLayout 放置返回按钮等操作键
5 添加 ScrollView放置文章内容,高度比重为1,占据所有空间
6 在ScrollView里面只能添加一个元素,放置一个 LinearLayout 做垂直部署放置图文资料
如果不放置ScrollView,则不会出现滚动操作,没有滚动条,这个是必须添加的。
简化的xml布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout>
<LinearLayout>
<ImageView />
<TextView />
</LinearLayout>
<LinearLayout>
<TextView />
<TextView />
</LinearLayout>
<LinearLayout>
<TextView />
</LinearLayout>
<ScrollView android:layout_weight="1">
<LinearLayout>
<ImageView />
<TextView />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout>
<LinearLayout>
<ImageView />
<TextView />
</LinearLayout>
<LinearLayout>
<TextView />
<TextView />
</LinearLayout>
<LinearLayout>
<TextView />
</LinearLayout>
<ScrollView android:layout_weight="1">
<LinearLayout>
<ImageView />
<TextView />
</LinearLayout>
</ScrollView>
</LinearLayout>
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
12星座的ABCD型
关于幸福的十七句名言

http://www.eoeandroid.com/thread-91571-1-1.html
但是 需要自己滚动鼠标滚轮 不然是不会自己滚动 轮流显示的
你的可以么? 有什么办法么?
实在不行 我想开辟一个Thread 定时地通知ScrollView.scrollBy() 来滚动
不知道有没有什么更好的办法?
我的布局如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<ScrollView android:layout_weight="1">
<LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="world"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="world"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
<ScrollView android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
你从DDMS里面可以看到错误提示的,没有指定宽高参数所致
就跳出那个 "异常错误"
你的是怎么写的?
可以给我一份这份源码么?感激不尽
email:shijintao@gmail.com