如果要将某个项目置于屏幕中央,请不要使用LinearLayout,因为这些用于在一行中显示多个项目。
所以替换:
android:layout_gravity="center_vertical|center_horizontal"
对于相关RelativeLayout选项:
android:layout_centerInParent="true"
所以你的布局文件将如下所示:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/findme">