У меня есть приложение, которое использует вкладки, чтобы показать различный контент ..... есть флажок admob ниже вкладок, которые никогда не должны двигаться ..... он должен быть заблокирован в нижней части экрана ...........tabhost или layout нажимает флажок admob ниже экрана
Основная часть содержимого отображается с использованием activity_main.xml, который включает content_main.xml, и у меня никогда не было проблемы с макетом до ... .. все подходит отлично .....
вот что макет ПРЕДПОЛАГАЕТ выглядеть ....
я недавно ADDE da новая вкладка и java-файл с именем bpm counter .... вкладка счетчика bpm имеет свой собственный макет и не использует activity_main.xml или content_main.xml, вместо этого использует свой собственный файл activity_main2.xml, и все это работает, но вот проблема ....
Когда я открываю приложение, все выглядит нормально, как всегда, с баннером внизу страницы .... однако, когда я нажимаю вкладку счетчика bpm, баннер admob перемещается вниз и идет на половину экрана ... тогда, когда я пытаюсь вернуться к любой другой вкладке, баннер перемещается вверх и я получаю пустое пространство под баннером admob.
вы можете увидеть проблему баннер перемещается вниз, когда я посещаю вкладку bpm здесь
, а затем, когда я пытаюсь вернуться на главную страницу или любой другой вкладке баннер перемещается путь вверх ... как вы можете видеть на фото ниже
я попытался изменить match_parent и fill_parent и попробовали много настроек в макете, но я не могу понять, что я делаю неправильно, и я собираюсь ударить головой о стену ... любая помощь будет замечательной и оцененной!
здесь мои файлы .xml макет
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.raptools.app.raptools.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
вот мой content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:screenOrientation="portrait"
android:background="#000000"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.raptools.app.raptools.MainActivity"
tools:showIn="@layout/activity_main">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="0dp"
android:layout_height="0dp"
android:screenOrientation="portrait"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-4075500144464557/8371434413"/>
<WebView
android:id="@+id/activity_main_webview"
android:layout_width="match_parent"
android:screenOrientation="portrait"
android:layout_height="match_parent"
android:layout_above="@id/adView" />
<ImageView
android:id="@+id/homepageimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:src="@drawable/homepageimage"
android:layout_above="@id/adView"
/>
<ImageView
android:id="@+id/comingimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:src="@drawable/comingsoon"
android:layout_above="@id/adView" />
</RelativeLayout>
эти два файла макет работал хорошо, пока я не попробовал добавить новая вкладка счетчика bpm ......
здесь is activity_main2.xml, что i ы используется для счетчика ударов в минуту Явы
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true"
tools:context="com.raptools.app.raptools.MainActivity"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:textColor="@color/ColorRemoveAds"
app:itemIconTint="@color/ColorRemoveAds"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:id="@+id/appView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@drawable/transitioning_background"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".BpmCounter">
<TextView
android:id="@+id/bpmLabelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="@string/bpm"
android:textColor="@color/textColor"
android:textSize="40sp"/>
<TextView
android:id="@+id/bpmTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/bpmLabelTextView"
android:layout_centerHorizontal="true"
android:text="@string/initial_bpm_value"
android:textColor="@color/textColor"
android:textSize="70sp"/>
<Button
android:id="@+id/tapButtonView"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_above="@+id/instructionalLabelTextView"
android:layout_centerHorizontal="true"
android:layout_marginBottom="32dp"
android:background="@drawable/round_button"
android:text="@string/tap"
android:textColor="@color/textColor"
android:textSize="30sp"/>
<TextView
android:id="@+id/instructionalLabelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="28dp"
android:text="@string/reset_instructions"
android:textColor="@color/textColor"/>
</RelativeLayout>
</LinearLayout>
я надеюсь, что я объяснил достаточно подробно и любая помощь будет удивительно!