午 好
局部代码:
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_user"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/shipperL2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shipper" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="班级"
android:textColor="@color/black" />
<TextView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="学生信息"
android:textColor="@color/black" />
</LinearLayout>
</LinearLayout>
...
就这样 重复很多个
结果 滑动的效果是左右滑动的 而且图标和文字之间距离很大 很大 T_T
我 该怎么调整 让它变成上下滑动的效果
而且 写了十几个linearlayout
界面上就显示了7个 为啥???
在线 等等等
ScrollView布局应该是最外层布局,这样才能对这个页面来进行上下滑动
ScrollView里面只能有一个子布局。
左右的原因: android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="horizontal" >。。。。。。
horizontal改成ver...
图标与文字的距离大的愿意:应该是weight的原因给拉伸了,不知道你为啥套这么多布局
建议简化布局,margin设置间距就好了。
你把最外边horizontal改成vertical
scrollview下面只能有一个最大的子布局,然后你的其他布局应该嵌套在这个子布局中 类似 android:layout_width="match_parent"
android:layout_height="match_parent" >< 你的嵌套布局
还有scrollview默认是上下滑动 第一层放向应该是vertical
scrollview下面只能包含一个控件