scrollview 的一个大问题
今天在用scrollview的时候 发现 scrollview里面包含的LinearLayout如果高度不超过屏幕 那么一切正常也不需要scrollview就是了。但是超过了之后会发现 LinearLayout内部最顶部的内容会显示不出来 数据那些都有在就是显示不出来 拉也拉不上去。
布局代码如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/task_item_daijiedan_top"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#37a8c8"
>
<ImageView
android:id="@+id/task_item_daijiedan_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/back"
android:layout_alignParentLeft="true"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ScrollView
android:id="@+id/task_item_zbrw_scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="50dp"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
>
<include
android:id="@+id/task_item_zbrw_info"
layout="@layout/task_item_taskinfo" />
<LinearLayout
android:background="#eeeeee"
android:layout_width="fill_parent"
android:layout_height="2dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text:"/>
<com.oa.view.TextProgressBar
android:id="@+id/task_item_zbrw_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/task_item_zbrw_renwufenpei"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:layout_centerInParent="true"
android:padding="10dp"
android:layout_margin="5dp"
android:background="@drawable/round_box"/>
</RelativeLayout>
<LinearLayout
android:background="#eeeeee"
android:layout_width="fill_parent"
android:layout_height="1dp"/>
<LinearLayout
android:id="@+id/task_item_zbrw_itemtask"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
/>
<LinearLayout
android:background="#eeeeee"
android:layout_width="fill_parent"
android:layout_height="2dp"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="test:"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#eeeeee"/>
<LinearLayout
android:id="@+id/task_item_zbrw_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
/>
<LinearLayout
android:background="#eeeeee"
android:layout_width="fill_parent"
android:layout_height="2dp"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="test:"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#eeeeee"/>
<LinearLayout
android:id="@+id/task_item_zbrw_attach"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:id="@+id/task_item_zbrw_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:background="#d9d9d9"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/task_item_zbrw_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/add"
android:padding="5dp"
android:layout_margin="2dp"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="0.05"/>
<EditText
android:id="@+id/task_item_zbrw_et_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/task_item_zbrw_jindu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进度"
android:padding="10dp"
android:layout_margin="2dp"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/round_null_box"
android:layout_weight="0.001"
/>
<Button
android:id="@+id/task_item_zbrw_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:background="@drawable/round_null_box"
android:padding="10dp"
android:layout_margin="2dp"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="0.001"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/task_item_zbrw_switchcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:visibility="gone"
android:padding="20dp"
>
<ImageView
android:id="@+id/task_item_zbrw_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/get_file"
android:layout_weight="1"/>
<ImageView
android:id="@+id/task_item_zbrw_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/get_photo"
android:layout_weight="1"/>
<ImageView
android:id="@+id/task_item_zbrw_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/get_audio"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>