“相对布局”按钮不可见



有人能帮我弄清楚为什么下面的按钮1在我的应用程序中不可见吗?

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".AirplaneActivity" >
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/button_activate" 
        android:onClick="activateAirPlaneMode"/>
</RelativeLayout>

是否调用了setContentView(R.layout.layout_name);,其中layout_name是布局中xml文件的名称(假设它是"活动")?

您的XML文件似乎没有任何问题,所以它一定是其他文件。

如果您提供更多的上下文/代码,可能会更有帮助。

最新更新