我可以想到的几件事
首先,您的RelativeLayout没有相对的定位信息.我会假设你的意思是将它放在一个LinearLayout中,方向设置为垂直于你所描述的方向.我的猜测是,该列表实际上并没有被绘制,因为它甚至没有被锚定到当前的RelativeLayout中.如果您使用RelativeLayout,请确保在app_name TextView上放置一个ID,并通过layout_below将ListView放置在其下.
LinearLayout解决方案
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content"
android:layout_width="wrap_content">
RelativeLayout解决方案:
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"