0

ı use tabs on portrait screen but ı cant do it on landscape screen mode.What I'm trying to make ;

https://i.stack.imgur.com/NWjzD.jpg

How can ı do thats screen?

ı do it for portrait screen mode.Here is;

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabHost 

android:id="@android:id/tabhost" 
android:layout_width="fill_parent"

android:layout_height="fill_parent">

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF" >

<TabWidget 
         android:id="@android:id/tabs"
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" />

    <FrameLayout 
        android:id="@android:id/tabcontent"

        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">
 </FrameLayout>


 <LinearLayout
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="horizontal" >


 <ImageButton
    android:id="@+id/imageButton1"
    android:layout_width="162dp"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/1" />


  <ImageButton
    android:id="@+id/imageButton2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/2" />

 </LinearLayout>


 <LinearLayout
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:orientation="horizontal" >


<ImageButton
    android:id="@+id/imageButton3"
   android:layout_width="162dp"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/3" />

<ImageButton
    android:id="@+id/imageButton4"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/4" />
    </LinearLayout>

  <LinearLayout 
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal" >

  <ImageButton
    android:id="@+id/imageButton5"
    android:layout_width="162dp"
    android:layout_height="wrap_content"
     android:src="@drawable/5" 
     android:background="#FFFFFF"
     android:scaleType="fitCenter"/>

 <ImageButton
     android:id="@+id/imageButton6"
   android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
     android:src="@drawable/6"
     android:background="#FFFFFF"
     android:scaleType="fitCenter"/>

 </LinearLayout>

 <LinearLayout 
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal" >



  <ImageButton
    android:id="@+id/imageButton7"
    android:layout_width="162dp"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/7" />

  <ImageButton
     android:id="@+id/imageButton8"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:src="@drawable/8"
     android:background="#FFFFFF"
     android:scaleType="fitCenter"/>

  </LinearLayout>



  <LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal" >

  <ImageButton
    android:id="@+id/imageButton9"
    android:layout_width="162dp"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/9" />


  <ImageButton
    android:id="@+id/imageButton10"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:scaleType="fitCenter"
    android:src="@drawable/10" />

  </LinearLayout>

  </LinearLayout>
  </TabHost>

  </ScrollView>

this is my main.xml for portrait screen and works.

Serkan
  • 641
  • 3
  • 11
  • 19
  • Not directly related, but please don't use Tabhost, it's deprecated – Ahmad Nov 27 '12 at 20:10
  • but ı use tabs on portrait screen in same application.. – Serkan Nov 27 '12 at 20:12
  • Use ActionBar tabs(or if you want to have it be be backwards compatible ActionBarSherlock tabs ). You don't have to, but they are better. :) – Ahmad Nov 27 '12 at 20:17
  • Why don't you simply create a second layout for landscape ? So you can redraw your view as you want. You just have to maintain same id and put this new layout in right project directory "layout-landscape" – kinghomer Nov 27 '12 at 23:18

0 Answers0