2013-10-01 66 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

相关问题