2010-12-07 4 views
-1

Ich möchte eine UI wie http://www.ndtv.com/static/images/iphone/motorola_droid.jpg erstellen, wo zusätzliche Links unter den Registerkarten sind. Wie können wir das erreichen?So erstellen Sie GUI mit Text-Links und Tabs

Ich habe bereits Registerkarten, aber nicht verstehen, wie Sie diese Textansicht mit diesem hinzufügen.

+2

Haben Sie bereits begonnen oder versucht, Layouts zu simulieren? Vielleicht wäre es besser zu experimentieren und zu versuchen, zu erreichen, was Sie wollen, und dann bestimmte Probleme zu veröffentlichen, denen Sie begegnen. Natürlich würden Sie einen 'TabHost' wünschen, und dann wäre der Tab-Inhalt wahrscheinlich ein' RelativeLayout' mit den Links und dem Text. – Zarah

Antwort

0

Versuchen Sie es wie das XML unten.

<?xml version="1.0" encoding="utf-8"?> 

    <TabHost 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:background="@drawable/background_retinav2"> 

      <LinearLayout 
       android:layout_gravity="center" 
       android:foregroundGravity="bottom" 
       android:background="@color/white" 
       android:id="@+id/rl_1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 

       <HorizontalScrollView 
        android:paddingTop="8dp" 
        android:id="@+id/gv" 
        android:layout_width="wrap_content" 
        android:layout_marginTop="0dp" 
        android:layout_height="wrap_content" 
        android:background="#ffffff" 
        android:scrollbars="none" 
        android:layout_weight="1" 
        android:foregroundGravity="bottom"> 

        <TextView 
         android:text="Top Stories" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"></TextView> 

        <TextView 
         android:text="News" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"/> 

        <LinearLayout 
         android:id="@+id/san_tag" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"> 
        </LinearLayout> 
       </HorizontalScrollView> 
      </LinearLayout> 

      <FrameLayout 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="vertical" 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"> 

       <WebView android:id="@+id/content_movies" 
        android:layout_weight="1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"/> 
      </FrameLayout> 
     </LinearLayout> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:gravity="top" 
      android:layout_gravity="top" 
      android:listSelector="@color/gray" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
    </TabHost> 

Innerhalb der Scrollview, platzieren Sie die Textansicht, was Sie brauchen, also hat es Ihre Titelmenüs. Weitere Informationen zu TabHost finden Sie unter der URL http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.html.

Verwandte Themen