【发布时间】:2012-05-21 08:24:29
【问题描述】:
在我的应用程序主页中,服务器向我发送了一些标志。其中之一是广告标志。如果设置为 true 我需要显示广告,如果设置为 false 我不应该显示它。
现在,问题。我需要像这样将广告空间放在 XML 文件中。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RileativeLayout
android:id="@+id/adv"
android:layout_width="fill_parent"
android:layout_height="100dip">
</RileativeLayout>
.
.
.
</LinearLayout >
根据上面的代码,如果标志设置为 false,我不会显示广告,但差距仍然存在于我的屏幕中。如何动态地从我的代码中删除它并向上移动其他视图(这是对它的打击)?
【问题讨论】:
-
view.setVisibility(View.GONE)
-
这将完成工作
findViewById(R.id.adv).setVisibility(View.GONE);