In the Layout
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:background="@color/app_color" android:layout_height="wrap_content" > </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/tab2" android:layout_width="match_parent" android:layout_height="match_parent" > <ScrollView android:id="@+id/scrollView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Address : " android:textSize="@dimen/text_size_20" /> <TextView android:id="@+id/address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Address here" android:layout_marginRight="30dp" android:textSize="@dimen/text_size_20" android:layout_marginTop="5dp" /> </LinearLayout> <Viewandroid:layout_width="fill_parent"android:layout_height="1dp"android:background="#EEEEEE" /> <LinearLayout android:id="@+id/principal_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <TextView android:id="@+id/principal" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Principal : ABC" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <Viewandroid:layout_width="fill_parent"android:layout_height="1dp"android:background="#EEEEEE" /> <LinearLayout android:id="@+id/emial_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Example@gmail.com" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:id="@+id/email_send" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Email" android:paddingTop="3dp" android:paddingBottom="3dp" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20"/> </LinearLayout> </LinearLayout> </LinearLayout> <Viewandroid:layout_width="fill_parent"android:layout_height="1dp"android:background="#EEEEEE" /> <LinearLayout android:id="@+id/land1_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/land_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="8888-888888888" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:id="@+id/call_land_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Call" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20" android:paddingTop="3dp" android:paddingBottom="3dp"/> </LinearLayout> </LinearLayout> </LinearLayout> <Viewandroid:layout_width="fill_parent"android:layout_height="1dp"android:background="#EEEEEE" /> <LinearLayout android:id="@+id/land2_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/land2_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="8888-888888" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:id="@+id/call_land2_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Call" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20" android:paddingTop="3dp" android:paddingBottom="3dp"/> </LinearLayout> </LinearLayout> </LinearLayout> <View android:layout_width="fill_parent" android:layout_height="1dp" android:background="#EEEEEE" /> <LinearLayout android:id="@+id/mobile1_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/mobile1_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="8888-8888888" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:id="@+id/call_mobile1_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Call" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20" android:paddingTop="3dp" android:paddingBottom="3dp"/> </LinearLayout> </LinearLayout> </LinearLayout> <View android:layout_width="fill_parent" android:layout_height="1dp" android:background="#EEEEEE" /> <LinearLayout android:id="@+id/mobile2_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/mobile2_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="8888-8888888" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:id="@+id/call_mobile2_no" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Call" android:padding="2dp" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20" android:paddingTop="3dp" android:paddingBottom="3dp"/> </LinearLayout> </LinearLayout> </LinearLayout> <Viewandroid:layout_width="fill_parent"android:layout_height="1dp"android:background="#EEEEEE" /> <LinearLayout android:id="@+id/url_linear" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="80" > <TextView android:id="@+id/url" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="www.example.com" android:padding="2dp" android:textSize="@dimen/text_size_20"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="20" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Call" android:padding="2dp" android:background="#5C5C5C" android:textColor="#f0f0f0f0" android:gravity="center_vertical|center_horizontal" android:textSize="@dimen/text_size_20" android:paddingTop="3dp" android:paddingBottom="3dp"/> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout> <LinearLayout android:id="@+id/tab1" android:layout_width="match_parent" android:layout_height="match_parent" > <ScrollView android:layout_width="fill_parent" android:fillViewport="true" android:background="@color/white" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:background="@color/white" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#E8E8E8" > <TextView android:id="@+id/inst_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp" android:typeface="serif" android:text="Name" android:textSize="@dimen/text_size_15" android:textStyle="bold" android:textColor="#2E2E2E"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:background="#F3F3F3" android:layout_height="match_parent" > <WebView android:id="@+id/textContent" android:layout_width="fill_parent" android:layout_height="match_parent" /> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout> <!-- <LinearLayout android:id="@+id/tab3" android:layout_width="match_parent" android:padding="10dp" android:background="@color/gray" android:layout_height="match_parent" > <ScrollView android:layout_width="fill_parent" android:fillViewport="true" android:background="@color/white" android:layout_height="fill_parent"> <include android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/location_layout" /></ScrollView> </LinearLayout> --> </FrameLayout> </LinearLayout> </TabHost>
In Java File
TabHost tabHost = (TabHost)getView().findViewById(android.R.id.tabhost); tabHost.setup(); TabSpec firstTabSpec = tabHost.newTabSpec("tid1"); TabSpec secondTabSpec = tabHost.newTabSpec("tid1"); TabSpec thirdTabSpec = tabHost.newTabSpec("tid1"); firstTabSpec.setIndicator("About"); secondTabSpec.setIndicator("Contact"); thirdTabSpec.setIndicator("Location"); firstTabSpec.setContent(R.id.tab1); secondTabSpec.setContent(R.id.tab2); // thirdTabSpec.setContent(R.id.tab3); tabHost.addTab(firstTabSpec); tabHost.addTab(secondTabSpec); // tabHost.addTab(thirdTabSpec);
No comments:
Post a Comment