我遇到了ListView和ScrollView的问题,并在listview和ScrollView之间添加了一个投影。
我制作了一个形状,它适用于ListView和相对布局,但不适用于ScrollView。
我已完成以下操作 - 仪表板列表
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:choiceMode = "singleChoice"
android:listSelector="#31ABD4"
android:drawSelectorOnTop="false"/>
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="No data"/>
</RelativeLayout>
滚动视图的仪表板
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white" >
<View
android:layout_width="10dp"
android:layout_height="fill_parent"
android:background="@drawable/shadow_left" />
</RelativeLayout>
</ScrollView>
查看
<?xml version ="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="180"
android:width="10dp"
android:centerX="0.1"
android:gravity="right"
android:startColor="#00000000"
android:endColor="#55000000"
android:type = "linear"
/>
</shape>
编辑 - 附加屏幕截图
谢谢大家, 詹姆斯
答案 0 :(得分:0)
似乎你错过了带有滚动视图的#34;仪表板上的填充&#34;
试试这个
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white" >
<View
android:layout_width="10dp"
android:layout_height="fill_parent"
android:background="@drawable/shadow_left" />
</RelativeLayout>
</ScrollView>