我使用线性布局来显示非常轻的初始屏幕.它有一个按钮,应该在屏幕中水平和垂直居中.但无论我尝试做什么,按钮都会在顶部对齐中心.我已经包含了下面的XML,有人能指出我正确的方向吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageButton android:id="@+id/btnFindMe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/findme"></ImageButton>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)