activity_main.xml
<include layout="@layout/title"/>
引用上章自定义标题栏
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><include layout="@layout/title"/><ListViewandroid:id="@+id/list_view"android:layout_width="match_parent"android:layout_height="match_parent"/>
</LinearLayout>
MainActivity.java
private String[] data = {"Apple","Banana","Apple","Banana","Apple","Banana","Apple","Banana","Apple","Banana"};@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);//隐藏系统自带标题栏ActionBar actionBar = getSupportActionBar();if(actionBar!=null){actionBar.hide();}ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1,data);ListView listView = findViewById(R.id.list_view);listView.setAdapter(adapter);}
当String[]中的数据足够的,超出屏幕即可滑动查看