2015-01-09 43 views
0

我用我的應用程序佈局如下:的LinearLayout的觀點是被裁剪

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/frame" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent"> 
    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" /> 
    <LinearLayout 
     android:id="@+id/id1" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:orientation="vertical"> 
      <LinearLayout 
       android:id="@+id/container" 
       android:layout_height="250dp" 
       android:layout_width="match_parent" 
       android:orientation="vertical"> 
        <FrameLayout 
        android:id="@+id/id2" 
        android:layout_height="200dp" 
        android:layout_width="match_parent" 
        android:background="@color/white" /> 
        <pagerslidingtabstrip.PagerSlidingTabStrip 
         android:id="@+id/tabs" 
         android:layout_width="match_parent" 
         android:layout_height="@dimen/pagertagstrip_height" 
         android:background="@android:color/transparent" /> 
      </LinearLayout> 
      <LinearLayout 
       android:id="@+id/ads" 
       android:layout_height="wrap_content" 
       android:layout_width="match_parent" 
       android:visibility="gone" /> 
    </LinearLayout> 
</FrameLayout> 

編輯:在用的FrameLayout ID2我正在插入另一個視圖尋呼機。具有ID Pager的尋呼機由pagerslidingtabstrip控制,幷包含4個ListViews。我還實現了一部分視差頭部示例。因此,滾動Listview會改變id = id1的LinearLayout的轉換。

問題是,在橫向模式下啓用廣告(將可見性設置爲可見,在ID爲ads的LinearLayout中插入視圖)後,部分廣告無法放入屏幕。但是,如果我滾動查看廣告的視圖正在裁剪。不在屏幕上的部分未呈現,我只能看到部分廣告視圖。我怎樣才能解決這個問題 ?

Cropped Ad

我收到的廣告像上面的示例照片(紅色是剛剛從背景)

+0

I不要站在爲什麼創建這種類型的視圖層次結構。爲什麼需要LinearLayout來顯示廣告。他們必須是您廣告提供商的SDK中的「查看」類。你用admob? –

+0

我正在使用自定義廣告提供商Sdk,並且指南指出要將LinearLayout用作廣告的父級(視圖)。我不認爲問題來自LinearLayout。 – koufa

+0

請發佈完整的XML ... –

回答

0

試試這個

添加layout_gravity="center_horizontal烏爾父framelayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="center_horizontal" > 

希望它有效

+0

這不起作用。 Viewpager沒有顯示任何內容,現在和橫向模式,我不能看到廣告視圖 – koufa

+0

是否有任何東西在你的孩子幀layot和線性佈局在你的xml ... –

+0

檢查我編輯的答案... –