效果图如下:
需要建一个menu
xml布局如下:
<?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"
tools:context="com.example.lyp1020k.lv.MainActivity"
android:orientation="vertical">
<Button
android:id="@+id/button1"
android:text="列表框"
android:onClick="showList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@