Ayusch
Ayusch

Reputation: 439

Testing Android Studio Apps on Hardware Device

I have just started to develop android apps. My computer does not have a great graphics card so I use my phone to debug apps. But when I run the app in android studio and select my phone, the app runs but it just shows a blank button on the top left hand corner whereas the original app has much more than that.

xml file

<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" />

I am attaching the screenshots to make it more clear. Please Help!

enter image description here

Upvotes: 0

Views: 72

Answers (1)

Shivanshu Verma
Shivanshu Verma

Reputation: 601

<?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>

change youe xml file with this code

Upvotes: 1

Related Questions