Android ListViewFragment中的Listview未出现在活动中

Android ListViewFragment中的Listview未出现在活动中,android,android-fragments,Android,Android Fragments,我有一个相对于ListViewFragment的带有一个FrameLayout的activity_main.xml。我想在这个活动中展示这个片段。但是它不工作,ListView没有出现。你知道问题在哪里吗 主要活动xml: listview xml: ListViewFragment: 向框架布局添加高度和宽度 <FrameLayout android:layout_width="match_parent" android:layout_height="match_pare

我有一个相对于ListViewFragment的带有一个FrameLayout的activity_main.xml。我想在这个活动中展示这个片段。但是它不工作,ListView没有出现。你知道问题在哪里吗

主要活动xml:

listview xml:

ListViewFragment:


向框架布局添加高度和宽度

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/fragment_list" />
此外,listView片段不能将listView作为父布局。因此,请使用类似于框架布局的布局对其进行包装

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</FrameLayout>

谢谢,但是列表视图也不会出现。更新答案。检查它。
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
public class ListViewFragment extends Fragment {
    private ListView editor=null;
    ArrayList<String> items = new ArrayList<>();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View result=inflater.inflate(R.layout.fragment_list, container, false);
        editor=(ListView) (result.findViewById(R.id.listView));
        ArrayAdapter arrayAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, items);
        editor.setAdapter(arrayAdapter);
        return result;
    }
}
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/fragment_list" />
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</FrameLayout>