I am trying to dynamically inflate a tabhost to the bottom of a view; however, no matter what I do it gets sent to the top.
RelativeLayout item = (RelativeLayout) findViewById(R.id.messagesactivityview);
View child = getLayoutInflater().inflate(R.layout.bottombartabs, null);
item.addView(child);
maketabs();
this is the code I'm using to inflate and here is the xml file of the tabhost I'm trying to inflate(note thatI've set layout_alignParentBottom to true, but it still does not work)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhosty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/switchtomessages"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="-3.5dip"
android:layout_marginRight="-3.5dip"
android:layout_weight="1"
android:background="@drawable/messages_icon" >
</ImageButton>
<ImageButton
android:id="@+id/switchtorequests"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="-3.5dip"
android:layout_marginRight="-3.5dip"
android:layout_weight="1"
android:background="@drawable/friend_request_icon" >
</ImageButton>
<ImageButton
android:id="@+id/switchtofriends"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="-3.5dip"
android:layout_marginRight="-3.5dip"
android:layout_weight="1"
android:background="@drawable/friends_icon" >
</ImageButton>
<ImageButton
android:id="@+id/uselesstab"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="-3.5dip"
android:layout_marginRight="-3.5dip"
android:layout_weight="1"
android:background="@drawable/settings_icon" >
</ImageButton>
</LinearLayout>
how do I send it to the bottom
change the code to
RelativeLayout item = (RelativeLayout) findViewById(R.id.messagesactivityview);
getLayoutInflater().inflate(R.layout.bottombartabs, item);
without any known parent, all LayoutParams you declared on the root element of your XML tree will just get thrown away.