您好我正在使用android我创建了一个导航抽屉应用程序。我编辑了其中一个视图,并且我还将Extends片段更改为片段活动。现在问题出在抽屉菜单中。我编辑的页面没有显示,点击它强行关闭。我是android新手,所以请帮我找错。感谢
这是我的代码
public class PagesFragment extends FragmentActivity {
private ListView listView1;
public PagesFragment(){}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_pages, container, false);
Weather weather_data[] = new Weather[]
{
new Weather(R.drawable.ic_launcher, "Task1","this is a task",R.drawable.green),
new Weather(R.drawable.ic_launcher, "Task2","this is a task",R.drawable.red),
new Weather(R.drawable.ic_launcher, "Task3","this is a task",R.drawable.red),
new Weather(R.drawable.ic_launcher, "Task4","this is a task",R.drawable.green),
new Weather(R.drawable.ic_launcher, "Task5","this is a task",R.drawable.red)
};
WeatherAdapter adapter = new WeatherAdapter(this,
R.layout.listview_item_row, weather_data);
listView1 = (ListView)findViewById(R.id.listView1);
View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
listView1.addHeaderView(header);
listView1.setAdapter(adapter);
return rootView;
}
}