<HorizontalScrollView
android:id="@+id/h_scrollview_1"
android:layout_width="match_parent"
android:layout_height="100sp"
android:background="#778899"
>
<LinearLayout
android:id="@+id/linearlayout_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#778899"
android:orientation="horizontal"
>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:id="@+id/v_scrollview_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#998877"
android:layout_below="@+id/h_scrollview_1"
>
<RelativeLayout
android:id="@+id/relativelayout_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#007f7f"
>
</RelativeLayout>
</ScrollView>
如图中的淡黄色字体,我在xml中使用了一个横向的滚动条,和一个纵向的滚动条,希望横向滚动条占三分之一,纵向滚动条占三分之二,在xml文件中,不知道怎么指定参数,只是写入了100sp,想在程序中再根据屏幕的像素大小来更新。在Logcat的提示中,横向滚动条默认显示172高度,我用layout设置为283后,最后一行又自动恢复为172,不知道是什么原因?难道用layout设置不可靠吗?
解决方案 »
- Android中如何保存并恢复WebView的内容?
- android TTS service
- android如何向数据库插入彩信数据
- 关于android 中的长度单位 px,dp,dip,pt,sp
- C#+android什么方式推送消息比较好?
- Cursor用startManagingCursor进行绑定后,在我添加数据库记录后,这个Corsor会自动更新数据!这是为什么,他在什么时候更新的?
- Android Dialog问题
- IntelliJ IDEA 13.1.1 配置好后运行无法运行模拟器
- fragment 如何向 activity 传递数据
- 关于java语言的一个编译问题
- 请教:代码能否获取当前程序的包名?
- 奇怪错误怎么回事,求大神看看,100分
不过你这里面还有其他的LinearLayout和RelativeLayout,可能会对结果有影响。
试试吧。