Android ListView不显示第一项

时间:2014-06-19 09:29:40

标签: java android listview arraylist

我从arraylist转换到列表视图。它有效,但它没有显示第一项。这是我的代码。请帮帮我。即使我将arraylist更改为String数组,它也无法工作。

ListView list = (ListView) mView.findViewById(R.id.outputList);

            ArrayList<String> listItem = new ArrayList<String>();
            listItem.add("one");
            listItem.add("two");

            ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                    android.R.layout.simple_list_item_1,listItem);
            list.setAdapter(adapter);

布局就在这里。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <ListView xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/outputList"
              android:layout_width="match_parent"
              android:layout_height="match_parent" />
</LinearLayout>

0 个答案:

没有答案
相关问题