java - Landscape mode: why do I get different result on my computer screen and different on my phone? -


this first time i'm making activity xml in landscape model. until now, saw on computer screen got on phone. now, it's not close! placed layouts, buttons , stuff, centered them need them, , tried on phone , stuff way off screen, stuff moved right, nothing made in xml. have move stuff little, try on phone, without order or rule. why happening?

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:background="@drawable/backgroundland" >      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:weightsum="4" >          <linearlayout             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:orientation="vertical"             android:layout_weight="1" >              <button                     android:id="@+id/ba1"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="a1" />              <button                     android:id="@+id/ba2"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="a2" />             <button                     android:id="@+id/ba3"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="a3" />             <button                     android:id="@+id/ba4"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="a4" />             <button                     android:id="@+id/bkolonaa"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="19sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="kolona a" />             </linearlayout>             <linearlayout                 android:layout_width="wrap_content"                 android:layout_height="match_parent"                 android:orientation="vertical"                 android:layout_weight="1" >               <button                     android:id="@+id/bb1"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="b1" />             <button                     android:id="@+id/bb2"                    android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="b2" />             <button                     android:id="@+id/bb3"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="b3" />             <button                     android:id="@+id/bb4"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="b4" />             <button                     android:id="@+id/bkolonab"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="19sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="kolona b" />                </linearlayout>              <linearlayout             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:orientation="vertical"             android:layout_weight="1" >             <button                     android:id="@+id/bc1"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="c1" />             <button                     android:id="@+id/bc2"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="c2" />             <button                     android:id="@+id/bc3"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="c3" />              <button                 android:id="@+id/bc4"                 android:layout_width="115dp"                 android:layout_height="35dp"                 android:layout_margin="3dp"                 android:background="@drawable/buttons"                 android:padding="0dp"                 android:text="c4"                 android:textcolor="#ffffff"                 android:textsize="18sp" />              <button                     android:id="@+id/bkolonac"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="19sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="kolona c" />             </linearlayout>              <linearlayout             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:orientation="vertical"             android:layout_weight="1" >             <button                     android:id="@+id/bd1"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="d1" />             <button                     android:id="@+id/bd2"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="d2" />             <button                     android:id="@+id/bd3"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="d3" />             <button                     android:id="@+id/bd4"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="18sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="d4" />             <button                     android:id="@+id/bkolonad"                     android:layout_width="115dp"                     android:background="@drawable/buttons"                     android:textsize="19sp"                     android:textcolor="#ffffff"                     android:padding="0dp"                     android:layout_margin="3dp"                     android:layout_height="35dp"                     android:text="kolona d" />             </linearlayout>               </linearlayout>              <linearlayout                 android:layout_width="fill_parent"                 android:layout_height="match_parent"                 android:orientation="horizontal" >                  <linearlayout                     android:layout_width="120dp"                     android:layout_height="wrap_content" >                      <button                         android:id="@+id/bizlaza"                         android:layout_width="50dp"                         android:layout_height="35dp"                         android:layout_marginleft="20dp"                         android:layout_margintop="3dp"                         android:background="@drawable/buttons_final"                         android:padding="0dp"                         android:text=""                         android:textcolor="#ffffff"                         android:textsize="20sp" />                 </linearlayout>                  <linearlayout                     android:layout_width="280dp"                     android:layout_height="wrap_content" >                      <button                         android:id="@+id/bkonacno"                         android:layout_width="260dp"                         android:layout_height="35dp"                         android:layout_margintop="3dp"                         android:background="@drawable/buttons_final"                         android:padding="0dp"                         android:text=""                         android:textcolor="#ffffff"                         android:textsize="20sp" />                 </linearlayout>                  <linearlayout                     android:layout_width="100dp"                     android:layout_height="match_parent" >                      <textview                         android:id="@+id/tvvreme"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_marginleft="30dp"                         android:layout_margintop="8dp"                         android:text="100"                         android:textcolor="#ff0000"                         android:textsize="20sp" />                 </linearlayout>             </linearlayout>  </linearlayout> 

enter image description here

enter image description here

enter image description here

what know emulator doesn't work same real devices why don't phone in debug mode see code do.

post code may can see if it's not emulator problem

edit:

just add android:layoutweight="1" 3 lyouts @ bottom should have better results :)

<linearlayout                  android:layout_width="fill_parent"                 android:layout_height="match_parent"                 android:orientation="horizontal" >                  <linearlayout                     android:layout_width="120dp"                     android:layout_weight="1"                     android:layout_height="wrap_content" >                      <button                         android:id="@+id/bizlaza"                         android:layout_width="50dp"                         android:layout_height="35dp"                         android:layout_marginleft="20dp"                         android:layout_margintop="3dp"                         android:background="@drawable/ic_launcher"                         android:padding="0dp"                         android:text=""                         android:textcolor="#ffffff"                         android:textsize="20sp" />                 </linearlayout>                  <linearlayout                     android:layout_width="280dp"                     android:layout_weight="1"                     android:layout_height="wrap_content" >                      <button                         android:id="@+id/bkonacno"                         android:layout_width="260dp"                         android:layout_height="35dp"                         android:layout_margintop="3dp"                         android:background="@drawable/ic_launcher"                         android:padding="0dp"                         android:textcolor="#ffffff"                         android:textsize="20sp" />                 </linearlayout>                  <linearlayout                     android:layout_width="100dp"                     android:layout_weight="1"                     android:layout_height="match_parent" >                      <textview                         android:id="@+id/tvvreme"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_marginleft="30dp"                         android:layout_margintop="8dp"                         android:text="100"                         android:textcolor="#ff0000"                         android:textsize="20sp" />                 </linearlayout>             </linearlayout> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -