ListView

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <com.autoscrollview.widget.AutoScrollViewPager
            android:id="@+id/view_pager"
            android:layout_width="450dip"
            android:layout_height="150dip" />

        <com.autoscrollview.widget.indicator.CirclePageIndicator
            android:id="@+id/indicator"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/view_pager"
            android:layout_centerHorizontal="true"
            android:padding="8dip" />
    </RelativeLayout>

    

        <ListView
            android:id="@+id/news_lv_notow"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:background="#00ffff" />
   

</LinearLayout>

代码的布局为

ListView_第1张图片

但是加了ScrollView之后就成这样了

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <com.autoscrollview.widget.AutoScrollViewPager
            android:id="@+id/view_pager"
            android:layout_width="450dip"
            android:layout_height="150dip" />

        <com.autoscrollview.widget.indicator.CirclePageIndicator
            android:id="@+id/indicator"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/view_pager"
            android:layout_centerHorizontal="true"
            android:padding="8dip" />
    </RelativeLayout>

    <ScrollView
        android:id="@+id/SL"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:overScrollMode="always" >

        <ListView
            android:id="@+id/news_lv_notow"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:background="#00ffff" />
    </ScrollView>

</LinearLayout>

ListView_第2张图片

而且运行之后ListView不能显示

protected void setListAdapter(ArrayAdapter<String> arrayAdapter) {
        
        List<String> date = new ArrayList<String>();
        
        date.add("数据测试1");
        date.add("数据测试2");
        date.add("数据测试3");
        date.add("数据测试4");
        // TODO 自动生成的方法存根
        listview = (ListView) findViewById(R.id.news_lv_notow);
        listview.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1,date));        
        
    }

显示错误为

03-25 21:06:02.149: E/(23035): appName=com.example.maoautoscrollviewdemo, acAppName=/system/bin/surfaceflinger
03-25 21:06:02.149: E/(23035): 0


运行后的布局界面,listview不能显示

你可能感兴趣的:(ListView,scrollview)