问题
Which Layout Can I used for Nexus 4 and Galaxy Nexus?
There is conflict between Nexus 7(800 x 1280) and Galaxy Nexus(720 x 1280) as attached in screenshot :
Nexus S
Galaxy Nexus
EDIT
home_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<include layout="@layout/home_tab_list" />
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@drawable/tab_bar_background" >
</TabWidget>
</LinearLayout>
</TabHost>
home_tab_list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/tab_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="visible" >
<ImageView
android:id="@+id/glob"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:contentDescription="@string/profile_picture_description"
android:src="@drawable/globe" />
<ImageView
android:id="@+id/createTrip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/pickMatches"
android:layout_alignLeft="@+id/glob"
android:layout_marginBottom="35dp"
android:layout_marginLeft="21dp"
android:contentDescription="@string/profile_picture_description"
android:src="@drawable/create_trip_background" />
<ImageView
android:id="@+id/pickMatches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/glob"
android:layout_marginBottom="24dp"
android:layout_marginLeft="80.5dp"
android:contentDescription="@string/profile_picture_description"
android:src="@drawable/pick_matches_background" />
<ImageView
android:id="@+id/meetMatch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/createTrip"
android:layout_marginRight="12dp"
android:clickable="true"
android:contentDescription="@string/profile_picture_description"
android:src="@drawable/meet_match_background" />
</RelativeLayout>
Please guide me on this.Any help will be appreciated.
回答1:
TabHost is deprecated and it is recommended you use Fragments instead.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Tutorials:
tutorial 1 , tutorial 2 , tutorial 3
If you really want to use TabHost, maybe someone else can help. I don't have much experience with that. Good luck!
来源:https://stackoverflow.com/questions/18850037/which-layout-is-used-for-galaxy-nexus