tags:

views:

50

answers:

2

What is "best practice"? Should each view have its own Activity? Never 2 views in 1 Activity?

+1  A: 

No no no... each widget is a View. Each Activity should have a Layout and each Layout should have multiple Views.

So, imagine you have this layout XML file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="View 1" />
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="View 2" />
</LinearLayout>

Both of those TextViews are Views. The LinearLayout is a ViewGroup and the whole thing makes up a Layout. An Activity would bind to the Layout then you could get handles to any of the Views.

If you're asking whether each Activity should have it's own layout then the answer is, generally speaking, yes.

fiXedd
A: 

I guess you can use tab widget. Please reference this "Hello, TabWidget". (http://developer.android.com/guide/tutorials/views/hello-tabwidget.html)

XC