Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的android listview没有';卷轴_Android_Listview_Scroll_Avd_Android 2.3 Gingerbread - Fatal编程技术网

我的android listview没有';卷轴

我的android listview没有';卷轴,android,listview,scroll,avd,android-2.3-gingerbread,Android,Listview,Scroll,Avd,Android 2.3 Gingerbread,我正在尝试制作一个具有listview小部件的程序,它显示我从数据库获取的一些项目。我为我的listview设置了一个arrayadapter,它显示元素,但不向下或向上滚动。这是我的代码,顺便说一句,我使用的是安卓2.3.3 avd ListView lv; lv = (ListView)findViewById(R.id.listView1); String[] liste = new String[suggestion.size()]; //liste is populated after

我正在尝试制作一个具有listview小部件的程序,它显示我从数据库获取的一些项目。我为我的listview设置了一个arrayadapter,它显示元素,但不向下或向上滚动。这是我的代码,顺便说一句,我使用的是安卓2.3.3 avd

ListView lv;
lv = (ListView)findViewById(R.id.listView1);
String[] liste = new String[suggestion.size()];
//liste is populated afterwards, there are about 100 items
ArrayAdapter<String> adapterForList = new ArrayAdapter<String>(getApplicationContext(),R.layout.listview,R.id.word,liste );
lv.setAdapter(adapterForList);
ListView-lv;
lv=(ListView)findViewById(R.id.listView1);
String[]liste=新字符串[suggestion.size()];
//liste之后填充,大约有100个项目
ArrayAdapterForList=新的ArrayAdapter(getApplicationContext(),R.layout.listview,R.id.word,liste);
低压设置适配器(适配器列表);
这是我的listview.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
<TextView
        android:id="@+id/word"
        style="@android:style/TextAppearance.Large"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

下面是activity使用的主要xml文件。上面的一个仅用于listview小部件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Spinner>
    <EditText android:id="@+id/etSQL" android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    </EditText>
</LinearLayout>


<ListView android:layout_width="fill_parent" android:id="@+id/listView1"
    android:layout_height="0dp" android:layout_weight="1"></ListView>
</LinearLayout>


您的XML不包含任何
列表视图

您的XML不包含任何
列表视图

有一个有趣的情况。 代码正在运行,如果我理解的话;唯一的问题是滚动…:)
(错误的xml文件)

有一个有趣的情况。 代码正在运行,如果我理解的话;唯一的问题是滚动…:)
(错误的xml文件)

问题是由于程序中的微调器。idk为什么,但它在我移除微调器后工作。

问题是因为程序中有一个微调器。idk为什么,但在我移除微调器后它工作了。

listview在哪里,它不是xml文件???如果您发布的布局中没有代码丢失,那么您的代码将导致空指针异常。没有您使用的id为listView1的视图。我猜是错误的xml文件,它只包含带有textview的linearlayout,该文件中没有listview?确定更新了问题并添加了activity使用的my main.xml文件。上面的一个是针对listview小部件的。我看不见,但我想问一下。您使用过任何scrollview吗?listview在哪里,它不是xml文件???如果您发布的布局中没有代码丢失,那么您的代码将导致空指针异常。没有您使用的id为listView1的视图。我猜是错误的xml文件,它只包含带有textview的linearlayout,该文件中没有listview?确定更新了问题并添加了activity使用的my main.xml文件。上面的一个是针对listview小部件的。我看不见,但我想问一下。您是否使用了scrollview?您说的xml文件错误,但它显示了listview,但它没有滚动您说的xml文件错误,但它显示了listview,但它没有滚动