2013-10-01 63 views
-1

我想實現滾動視圖,但是使用layoutweight屬性。其實我想在全屏顯示 我的活動內容,如果用戶向下滾動,然後他可以看到廣告 我該怎麼做,請告訴我。使用Layoutweight標籤的滾動視圖

回答

1

的你應該增加你的廣告橫幅裏面你的滾動視圖。 ..類似的東西:

<ScrollView 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

<LinearLayout android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <LinearLayout android:id="@+id/content" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     > 

    </LinearLayout> 

    <com.ads.adsbanner 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/myAdBaner"/> 

</LinearLayout> 

</ScrollView> 

只需將您的內容添加到「內容」。

0

我沒有完全理解你的問題,但我認爲下面的佈局將努力爲你...你告訴你,如果有任何的概率

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <!-- MAIN CONTENT --> 
     </LinearLayout> 
    </ScrollView> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <!-- ADS --> 
    </LinearLayout> 

</LinearLayout> 
+0

實際上它就像我想在全屏幕上顯示我的內容,但我有一個廣告,我想要在底部顯示或用戶滑動下來,他看到ad.when活動開始廣告不顯示在屏幕上,但是當用戶向下滾動顯示廣告 –

+0

然後看看Cehm的答案..我希望它會爲你工作:) – Rehan

相關問題