Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Anyone wants to take a shot at suggesting a better layout?
    text
    copied!<p>I never designed UIs (more of a middleware guy) before so I apologize if the question is stupid. I am designing a UI to look something like the following: </p> <blockquote> <hr> <h2>ImageView ImageView</h2> <p>TabHost </p> <h2>Tab 0 ------ Tab 1 ------ Tab 2</h2> <h2>-----INSIDE EACH TAB-----</h2> <p>TextView </p> <p>ListView </p> <h2> - Consists of ImageView TextView</h2> <hr> </blockquote> <p>The problem is I think I am following a very inefficient way of doing the whole stuff. The onCreate method is as follows:</p> <p>CODE:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost mTabHost = getTabHost(); Drawable Tab1Icon = getResources().getDrawable(R.drawable.tab1_icon); Drawable Tab2Icon = getResources().getDrawable(R.drawable.tab2_icon); Drawable Tab3Icon = getResources().getDrawable(R.drawable.tab3_icon); mTabHost.addTab(mTabHost.newTabSpec("Tab1").setIndicator("Tab 1", Tab1Icon).setContent(new Intent(this, Tab1.class))); mTabHost.addTab(mTabHost.newTabSpec("Tab2").setIndicator("Tab 2", Tab1Icon).setContent(new Intent(this, Tab2.class))); mTabHost.addTab(mTabHost.newTabSpec("Tab3").setIndicator("Tab 3", Tab1Icon).setContent(new Intent(this, Tab3.class))); mTabHost.setCurrentTab(0); } </code></pre> <p>This program crashes on CupCake (v1.5) complaining about StackOverflowException but runs well on Donut (v1.6). This is my main.xml: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/application_background" &gt; &lt;TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0" android:background="@color/application_background"&gt; &lt;TableRow&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ImageView id="@+id/picview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/leftlogo" android:paddingRight="105sp" /&gt; &lt;Button android:id="@+id/picview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/rightlogo" /&gt; &lt;/LinearLayout&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/FrameLayout&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Any suggestions regarding the design please? </p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload