Skip to content Skip to sidebar Skip to footer

How To Use Custom IPhone Tab In FragmentActivity?

I am new in Android and I tried to create a tab using FragmentActivity from codes that I found online. http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way

Solution 1:

Solved it! Finally! After testing other resources that I referred to, I realized that layout_alignParentBottom in RelativeLayout does not give any outcome. Hence I tried aligning the TabWidget to the bottom instead, and it worked!

This is my main.xml that contain TabHost and TabWidget. http://pastie.org/pastes/5188297/text?key=lqfp3jnofs5kgsvslm3yg

Keep the tab_indicator.xml / the settings for the text and image like this : http://pastie.org/pastes/5187408/text?key=qxxa5xxrhsburebllyhmw

And here is the a custom iPhone tab that uses FragmentActivity :

P/S : Sorry if my Java file is confusing, I'm new and if there is anything I did wrong, do tell me.

enter image description here


Solution 2:

try this Honey >

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="55dp"    
    android:layout_weight="1"
    android:orientation="vertical" 
    android:layout_gravity="bottom"  
    android:background="@android:drawable/title_bar"
    android:padding="5dp"> 

    <TextView android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true"
        style="?android:attr/tabWidgetStyle"/>

    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:src="@drawable/ic_action_search" />

      <ImageView
          android:id="@+id/icon"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_centerVertical="true"
          android:layout_marginLeft="49dp"
          android:src="@drawable/ic_action_search" />

</RelativeLayout>

Post a Comment for "How To Use Custom IPhone Tab In FragmentActivity?"