I’m trying to align an ad layout at the top of a Tab Layout and am not having much luck. It seems to be stuck aligning at the bottom. I’ve configured the Tab Layout so the tabs are at the bottom of the screen:
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:id="@+id/adLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp"
>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="0dp"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="23dp"
android:background="@drawable/tab_bg_selector"
android:layout_weight="0"
/>
</LinearLayout>
</TabHost>
Update:
I fix it, I forgot I was setting the alignment in the code, like this:
final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
Once I changed ALIGN_PARENT_BOTTOM to ALIGN_PARENT_TOP, it worked.
I can’t understand your layout structure but what I understood is that you want to display ads at the top of the screen and for that I modify your code