I\'ve just started working on Android. Could you please give me a tip if it\'s possible to realize the following screen:
http://i.stack.imgur.com/0Hy6W.png
I
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView
android:id="@+id/left_list"
android:layout_width="100dip"
android:layout_height="wrap_content" />
<TabHost
android:id="@+id/tab_host"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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">
<ListView
android:id="@+id/listview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ListView
android:id="@+id/listview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ListView
android:id="@+id/listview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
row.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dip" />
package com.stackoverflow.q5747834;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TabHost;
public class ListViewsGalore extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
List listContents = new ArrayList();
listContents.add("one");
listContents.add("two");
listContents.add("three");
listContents.add("four");
listContents.add("five");
listContents.add("six");
listContents.add("seven");
listContents.add("eight");
listContents.add("nine");
listContents.add("ten");
listContents.add("eleven");
listContents.add("twelve");
listContents.add("thirteen");
listContents.add("fourteen");
listContents.add("fifteen");
listContents.add("sixteen");
listContents.add("seventeen");
listContents.add("eighteen");
listContents.add("nineteen");
listContents.add("twenty");
ListView leftList = (ListView) findViewById(R.id.left_list);
leftList.setAdapter(new ArrayAdapter(this, R.layout.row, listContents));
ListView listview1 = (ListView) findViewById(R.id.listview1);
listview1.setAdapter(new ArrayAdapter(this, R.layout.row, listContents));
ListView listview2 = (ListView) findViewById(R.id.listview2);
listview2.setAdapter(new ArrayAdapter(this, R.layout.row, listContents));
ListView listview3 = (ListView) findViewById(R.id.listview3);
listview3.setAdapter(new ArrayAdapter(this, R.layout.row, listContents));
TabHost mTabHost = (TabHost) findViewById(R.id.tab_host);
mTabHost.setup();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB 1").setContent(R.id.listview1));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2").setContent(R.id.listview2));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3").setContent(R.id.listview3));
mTabHost.setCurrentTab(0);
}
}
Yes it is.
You can have a look a at this to understand how Android views work
Is a design for tablets?
You must take a look to the Fragments
http://developer.android.com/guide/topics/fundamentals/fragments.html
I hope it'll help you.