2017-03-22 8 views
1

画面の下部にadmob bannerを表示している写真アプリケーションが1つあります。私はそれをjavaから管理し、必要に応じていつでもそれを隠しています。私はView.Gone ParentBottomビューで問題が発生しています

image

以下のような広告を表示するしかし、私はバナーを非表示にしたときに....下部のナビゲーションツールバーが

image

マイ下記のような空白示す上面と画面上に起こっているとき、その細かい作業しますXMLは以下のようになります。私の問題を確認して助けてください。 値がll_adLayout_latestのxmlのbottomはadviewです。あなたはll_adLayout_latest上になるように設定

<LinearLayout 
      android:background="@color/colorPrimary" 
      android:id="@+id/pageNavLayout" 
      android:orientation="horizontal" 
      android:layout_above="@+id/ll_adLayout_latest" 
      android:layout_width="match_parent" 
      android:layout_height="48dp"> 

を持っており、あなたはそれView.GONE作るときll_adLayout_latestがあるかのように、レイアウトを再検討するためだおかげ

<?xml version="1.0" encoding="utf-8"?> 
 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
     xmlns:tools="http://schemas.android.com/tools" 
 
     android:layout_width="match_parent" 
 
     android:background="@color/image_back" 
 
     android:layout_height="match_parent" 
 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
 
     xmlns:fab="http://schemas.android.com/apk/res-auto" 
 
     tools:context="com.karopass.karoshare.ImageDetails"> 
 

 
     <android.support.v7.widget.Toolbar 
 
      android:id="@+id/toolbar_imageDetails" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="wrap_content" 
 
      android:background="@color/colorPrimary" 
 
      android:theme="@style/AppTheme.AppBarOverlay" 
 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 
 
     </android.support.v7.widget.Toolbar> 
 

 
     <com.example.utils.ExtendedViewPager 
 
      android:id="@+id/view_pager_extended" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="match_parent" 
 
      android:layout_above="@+id/pageNavCount" 
 
      android:layout_below="@+id/toolbar_imageDetails" 
 
      android:background="@color/image_back"/> 
 

 
     <LinearLayout 
 
      android:id="@+id/pageNavCount" 
 
      android:orientation="horizontal" 
 
      android:layout_above="@+id/pageNavLayout" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="20dp"> 
 

 

 

 
      <RelativeLayout 
 
       android:layout_weight="3" 
 
       android:id="@+id/new_time_count" 
 
       style="@style/SelectableItemBackground" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 

 
       <TextView 
 
        android:id="@+id/txt_view" 
 
        android:layout_width="wrap_content" 
 
        android:layout_height="wrap_content" 
 
        android:text="1 Month ago" 
 
        android:textSize="12sp" 
 
        android:paddingLeft="5sp" 
 
        android:layout_centerVertical="true" 
 
        android:textColor="#cccccc" 
 
        android:gravity="center|start" /> 
 
      </RelativeLayout> 
 

 

 

 

 

 

 

 
      <RelativeLayout 
 

 
       android:layout_weight="1" 
 
       android:id="@+id/new_share_count" 
 
       style="@style/SelectableItemBackground" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 
       <TextView 
 
        android:id="@+id/share_count" 
 
        android:layout_centerInParent="true" 
 
        android:layout_width="wrap_content" 
 
        android:layout_height="wrap_content" 
 
        android:text="999" 
 
        android:textSize="12sp" 
 
        android:paddingLeft="5sp" 
 
        android:layout_centerVertical="true" 
 
        android:textColor="#cccccc" 
 
        android:gravity="center|start" /> 
 
      </RelativeLayout> 
 

 
      <RelativeLayout 
 

 
       android:layout_weight="1" 
 
       style="@style/SelectableItemBackground" 
 
       android:id="@+id/new_save_count" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 

 
       <TextView 
 
        android:id="@+id/like_count" 
 
        android:layout_centerInParent="true" 
 
        android:layout_width="wrap_content" 
 
        android:layout_height="wrap_content" 
 
        android:text="999" 
 
        android:textSize="12sp" 
 
        android:paddingLeft="5sp" 
 
        android:layout_centerVertical="true" 
 
        android:textColor="#cccccc" 
 
        android:gravity="center|start" /> 
 
      </RelativeLayout> 
 

 

 

 
     </LinearLayout> 
 

 

 

 
     <LinearLayout 
 
      android:background="@color/colorPrimary" 
 
      android:id="@+id/pageNavLayout" 
 
      android:orientation="horizontal" 
 
      android:layout_above="@+id/ll_adLayout_latest" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="48dp"> 
 

 

 

 
      <RelativeLayout 
 
       android:layout_weight="1" 
 
       android:id="@+id/new_time" 
 
       style="@style/SelectableItemBackground" 
 
       android:clickable="true" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 

 
       <ImageView 
 
        android:layout_centerInParent="true" 
 
        android:scaleType="fitCenter" 
 
        android:src="@mipmap/ic_past_961" 
 
        android:layout_width="@dimen/nav_but_size" 
 
        android:layout_height="@dimen/nav_but_size" /> 
 
      </RelativeLayout>--> 
 

 

 
      <RelativeLayout 
 
       android:id="@+id/new_copy" 
 
       android:clickable="true" 
 
       style="@style/SelectableItemBackground" 
 
       android:layout_weight="1" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 

 
       <ImageView 
 
        android:layout_centerInParent="true" 
 
        android:src="@mipmap/ic_copy_96" 
 
        android:layout_width="@dimen/nav_but_size" 
 
        android:layout_height="@dimen/nav_but_size" /> 
 

 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 

 
       android:layout_weight="1" 
 
       android:id="@+id/new_save" 
 
       style="@style/SelectableItemBackground" 
 
       android:clickable="true" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 
       <ImageView 
 
        android:layout_centerInParent="true" 
 
        android:src="@mipmap/ic_save_96" 
 
        android:layout_width="@dimen/nav_but_size" 
 
        android:layout_height="@dimen/nav_but_size" /> 
 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 

 
       android:layout_weight="1" 
 
       android:id="@+id/new_share" 
 
       style="@style/SelectableItemBackground" 
 
       android:clickable="true" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 
       <ImageView 
 
        android:layout_centerInParent="true" 
 
        android:src="@mipmap/ic_share_96" 
 
        android:layout_width="@dimen/nav_but_size" 
 
        android:layout_height="@dimen/nav_but_size" /> 
 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 

 
       android:layout_weight="1" 
 
       style="@style/SelectableItemBackground" 
 
       android:clickable="true" 
 
       android:id="@+id/new_fav" 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent"> 
 

 
       <ImageView 
 
        android:layout_centerInParent="true" 
 
        android:src="@mipmap/ic_hearts_96" 
 
        android:layout_width="@dimen/nav_but_size" 
 
        android:layout_height="@dimen/nav_but_size"/> 
 
      </RelativeLayout> 
 

 

 

 
     </LinearLayout> 
 

 
     <LinearLayout 
 
      android:id="@+id/ll_adLayout_latest" 
 
      android:layout_alignParentBottom="true" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="wrap_content" 
 
      android:layout_gravity="center_horizontal" 
 
      android:gravity="bottom" 
 
      android:orientation="vertical"> 
 

 
     </LinearLayout> 
 

 
    </RelativeLayout>

答えて

0

レイアウトでは全くありません。

これらの2つのうちのいずれか(または両方とも、必要な動作に応じて)を実行できます。

  1. レイアウトをll_adLayout_latestの位置に依存しないように設定します。
  2. 代わりのView.GONEView.INVISIBLEを使用する場合は、View.INVISIBLE

を使用し、レイアウトがll_adLayout_latestがなかったかのように、それはあなたが堅くている依存関係を維持します動作しません。

関連する問題