title: Creating layout for tablet and phone android
body: <p>Ok, so, I have read a lot about creating layout for android devices. I thought I was on the right path when I wasnt. My situation is next:</p>
  
  <p>I created layout-normal, layout-normal-land, layout-small, layout-small-land, etc... Then, I got values-normal-ldpi, values-normal-mdpi, and all the other qualifiers. I put the dimensions in those folders and in my layout, I use just them. Here is my layout code:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#e8e8e8"
      android:orientation="vertical"&gt;
  
  
      &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/toolbarMainScreen"
          android:layout_width="match_parent"
          android:layout_height="@dimen/visinaHeadera"
          android:background="#1d6cb5"
          android:minHeight="?attr/actionBarSize"
          android:theme="@style/Widget.AppCompat.Toolbar"&gt;
  
          &lt;ImageButton
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_gravity="left"
              android:background="@drawable/senkaokoikonica"
              android:scaleType="center"
              android:src="@drawable/homeicon" /&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="horizontal"&gt;
  
              &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_marginLeft="@dimen/razmakOdHomeDoTexta"
                  android:layout_weight="1"
                  android:paddingTop="@dimen/marginaTextaZaIspisuHeaderu"
                  android:text="Akcije i katalozi"
                  android:textAlignment="center"
                  android:textColor="#ffffff"
                  android:textSize="15sp"
                  android:typeface="sans" /&gt;
  
  
              &lt;ImageButton
                  android:id="@+id/imageButtonOtvoriSearch"
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:background="@drawable/search_klik"
                  android:scaleType="center"
                  android:src="@drawable/searchicon" /&gt;
  
              &lt;View
                  android:layout_width="@dimen/razmakIzmedjuLupeIShare"
                  android:layout_height="match_parent" /&gt;
  
              &lt;ImageButton
                  android:id="@+id/shareButtonKataloziMainScreen"
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:background="@drawable/senkaokoikonica"
                  android:scaleType="center"
                  android:src="@drawable/shareicon" /&gt;
  
              &lt;View
                  android:layout_width="@dimen/razmakIzmedjuLupeIShare"
                  android:layout_height="match_parent" /&gt;
  
              &lt;ImageButton
                  android:id="@+id/settingsButtonMainScreen"
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:background="@drawable/senkaokoikonica"
                  android:scaleType="center"
                  android:src="@drawable/settingsicon" /&gt;
  
              &lt;View
                  android:layout_width="@dimen/razmakIzmedjuSettingsIDesnogKraja"
                  android:layout_height="match_parent" /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="3.33dp"
          android:layout_below="@+id/toolbarMainScreen"
          android:background="@drawable/headshad480" /&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="3.33dp"
          android:layout_below="@+id/linearLayoutZaSearchMainScreen"
          android:background="@drawable/headshad480"
          android:visibility="invisible" /&gt;
  
  
      &lt;LinearLayout
          android:id="@+id/linearLayoutZaSearchMainScreen"
          android:layout_width="match_parent"
          android:layout_height="@dimen/visinaDrugogHeadera"
          android:layout_below="@+id/toolbarMainScreen"
          android:background="@drawable/searchbg"
          android:orientation="horizontal"
          android:visibility="invisible"&gt;
  
          &lt;LinearLayout
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:background="@drawable/searchbg"&gt;
  
              &lt;EditText
                  android:id="@+id/editTextMainScreen"
                  android:layout_width="match_parent"
                  android:layout_height="@dimen/editTextSearchVisina"
                  android:layout_marginBottom="@dimen/editTextMarginaBot"
                  android:layout_marginLeft="@dimen/editTextMarginaLeft"
                  android:layout_marginRight="@dimen/editTextMarginaRight"
                  android:layout_marginTop="@dimen/editTextMarginaTop"
                  android:layout_weight="1"
                  android:background="@drawable/edittext_conrer"
                  android:hint="Pretraga"
                  android:textColor="#000000"
                  android:textColorHint="#000000"
                  android:textStyle="italic" /&gt;
          &lt;/LinearLayout&gt;
  
  
          &lt;ImageButton
              android:id="@+id/imageButtonSearch"
              android:layout_width="wrap_content"
              android:layout_height="@dimen/searchButtSearchVisina"
              android:layout_gravity="right"
              android:layout_marginBottom="@dimen/searchButtMarginaBot"
              android:layout_marginRight="@dimen/searchButtMarginaRight"
              android:layout_marginTop="@dimen/searchButtMarginaTop"
              android:background="@drawable/search_klik"
              android:scaleType="center"
              android:src="@drawable/searchiconkrug" /&gt;
  
      &lt;/LinearLayout&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_above="@+id/linearLayoutZaReklameMainScreen"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:layout_below="@+id/toolbarMainScreen"
          android:layout_weight="1"
          android:baselineAligned="false"
          android:orientation="vertical"&gt;
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"&gt;
  
              &lt;LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="1"
                  android:orientation="vertical"&gt;
  
  
                  &lt;ImageButton
                      android:id="@+id/buttonProdavci"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_marginBottom="@dimen/marginIzmedjuSlika"
                      android:layout_marginLeft="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginRight="@dimen/marginIzmedjuSlika"
                      android:layout_marginTop="@dimen/marginTopZaGornjeSlike"
                      android:layout_weight="1"
                      android:background="@drawable/prodavci"
                      android:scaleType="center" /&gt;
  
  
              &lt;/LinearLayout&gt;
  
  
              &lt;LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="1"
                  android:orientation="vertical"&gt;
  
  
                  &lt;ImageButton
                      android:id="@+id/buttonProizvodi"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_marginBottom="@dimen/marginIzmedjuSlika"
                      android:layout_marginLeft="@dimen/marginIzmedjuSlika"
                      android:layout_marginRight="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginTop="@dimen/marginTopZaGornjeSlike"
                      android:layout_weight="1"
                      android:background="@drawable/proizvodi"
                      android:scaleType="center" /&gt;
  
  
              &lt;/LinearLayout&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"&gt;
  
  
              &lt;LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="1"
                  android:orientation="vertical"&gt;
  
                  &lt;ImageButton
                      android:id="@+id/buttonBarkod"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_marginBottom="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginLeft="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginRight="@dimen/marginIzmedjuSlika"
                      android:layout_marginTop="@dimen/marginIzmedjuSlika"
                      android:layout_weight="1"
                      android:adjustViewBounds="true"
                      android:background="@drawable/barcode"
                      android:scaleType="center" /&gt;
  
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="1"
                  android:orientation="vertical"&gt;
  
  
                  &lt;ImageButton
                      android:id="@+id/buttonSviKatalozi"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_centerHorizontal="true"
                      android:layout_marginBottom="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginLeft="@dimen/marginIzmedjuSlika"
                      android:layout_marginRight="@dimen/marginIzmedjuSlikaIZida"
                      android:layout_marginTop="@dimen/marginIzmedjuSlika"
                      android:layout_weight="1"
                      android:adjustViewBounds="true"
                      android:background="@drawable/svikatalozi"
                      android:scaleType="center" /&gt;
  
  
              &lt;/LinearLayout&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
      &lt;/LinearLayout&gt;
  
  
      &lt;LinearLayout
          android:id="@+id/linearLayoutZaReklameMainScreen"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:gravity="center|bottom"&gt;
  
          &lt;com.google.android.gms.ads.AdView
              android:id="@+id/adViewMainScreen"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true"
              android:layout_gravity="bottom|center"
              ads:adSize="BANNER"
              ads:adUnitId="@string/aik_ad_unit_id"&gt;&lt;/com.google.android.gms.ads.AdView&gt;
  
  
      &lt;/LinearLayout&gt;
  
  
      &lt;LinearLayout
          android:id="@+id/lejoutZaTransparentonstMainScreen"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentBottom="true"
          android:layout_below="@id/toolbarMainScreen"
          android:alpha=".35"
          android:background="#000000"
          android:orientation="horizontal"
          android:visibility="invisible" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Still, when I test it on my device(Samsung Galaxy s2 plus) it looks very good. WHen I test it on Nexus 5, it doesnt look even close.</p>
  
  <p>Any suggestions on how to create adequate number of layout for the best solution for phones and tablets?</p>