android studio: layout preview diffrent from actual device layout -


so, installed android studio , try run default project button on real device , i'm seeing:

enter image description here

the text in right side instead left, envelop icon on left instead right, , button wrap himself on screen.

the xml code:

 <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" 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" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.hello.tsvi.myapp.mainactivity" tools:showin="@layout/activity_main" android:background="#1bb0ce">  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="hello world!"     android:id="@+id/textview" />  <button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="new button"     android:id="@+id/button"     android:layout_below="@+id/textview"     android:layout_alignparentright="true"     android:layout_alignparentend="true"     android:layout_marginright="41dp"     android:layout_marginend="41dp"     android:layout_margintop="145dp" />     </relativelayout> 

any idea did wrong?

try this:

<?xml version="1.0" encoding="utf-8"?>         <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:app="http://schemas.android.com/apk/res-auto"         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"         app:layout_behavior="@string/appbar_scrolling_view_behavior"         tools:context="com.hello.tsvi.myapp.mainactivity"         tools:showin="@layout/activity_main"         android:background="#1bb0ce">          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="hello world!"             android:id="@+id/textview"             android:layout_alignparentright="true" />          <button             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="your envelop button"             android:id="@+id/button"             android:layout_below="@+id/textview"             android:layout_alignparentleft="true" />             </relativelayout> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -