1

的顶部,我想创建一个广告横幅其显示在屏幕的底部,并在屏幕的页面,除了旗帜滚动。旗帜不断停留在底部。布局元素:一个在另一个

所以,我需要一个<ScrollView>元素,我需要一个<LinearLayout>元素位于<ScrollView>的顶部。并位于屏幕的底部

如何在Android中实现广告横幅布局? (我正在开发Android 2.1 API 7应用程序),有人可以给我一些提示吗?

** * ***UPDATE* ** * **

我想通了使用<FrameLayout>,但仍然有兴趣听听其他人的意见。

+0

FrameLayout是最简单的方法。下面的其他答案太复杂了。 – wnafee 2012-02-16 02:54:00

回答

1

你有另一种选择(和简单得多我猜)是使用这种类型的布局:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <ScrollView> 
     //here is the scroll 
    </ScrollView> 

    <LinearLayout android:layout_alignParentBottom="true"> 
     // here is the ad 
    </LinearLayout> 

</RelativeLayout> 
1

我看到一些方法来做到这一点。

1简单使用Activity.addContentView()为活动添加额外的内容视图。

  • 广告不是从主要布局

2使用android:layout_alignParentBottom依赖作为建议slukian

  • 你的广告依赖从主要布局

3创建包含广告自己的视图类。在方法onDraw()调用:canvas.drawBitmap(bitmap, posX, posY, null);。 posX,posY - 是绝对位置。然后按照方式1将您的视图添加到主布局。

相关问题