2015-10-23 57 views
0

我剛開始開發android應用程序。 我的電腦沒有很棒的顯卡,所以我用我的手機來調試應用程序。 但是當我在android studio中運行應用程序並選擇我的手機時,該應用程序將運行,但它只是在左上角顯示一個空白按鈕,而原始應用程序遠不止於此。在硬件設備上測試Android Studio應用程序

xml文件

<RelativeLayout xmlns:android="schemas.android.com/apk/res/android"; xmlns:tools="schemas.android.com/tools"; 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     tools:context=".MainActivity" android:id="@+id/myapp" 
     android:background="#ff0060"> 
    <Button android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:text="Hello World" 
     android:id="@+id/button" android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 

我附上了截圖,使之更加清晰。請幫忙!

enter image description here

+0

ü可以添加一些代碼的? –

+0

從哪個文件? – Ayusch

+0

xml文件和登陸活動 –

回答

1
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingBottom="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_vertical_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" 
    android:id="@+id/myapp"> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/button" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:text="Hello World" 
    android:textColor="#fff" 
    android:background="#ff0060" /> 
</RelativeLayout> 

變化與此代碼YOUE xml文件

相關問題