Если вы используете закладки для навигации по приложению, то часто бывает удобным сделать внизу экрана. Это делается элементарно при помощи разметки


<?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="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<!-- располагаем FrameLayout НАД TabWidget,
обратите внимание на веса для элементов -->
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5dp" />
<!-- выставляем marginBottom = -5dp чтобы скрыть серую полоску снизу -->
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_marginBottom="-5dp"/>

</LinearLayout>
</TabHost>

Все, теперь у вас есть замечательные закладки внизу экрана!

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *