是否可以将横幅放在选项卡主机下方,并且在该横幅中有两个按钮,我想从当前可见的 Activity 中访问这两个按钮???
例如有两个xml文件,一个是tab-host,另一个是activity xml文件。在 tab-host xml 文件中我写了这样的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/seekBar1"
android:background="#FFB5C5"
android:gravity="center_horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="No track info available..."
android:textColor="@android:color/black" />
</LinearLayout>
现在,如果我想将横幅放在选项卡主机下方,我必须在此文件中为该横幅编写代码...
现在但主要问题是在横幅中有两个按钮正在被具有的 Activity 访问
setContentView(R.layout.activity);
不是
setContentView(R.layout.tabhost);
所以我不会从
访问横幅 setContentView(R.layout.activity);
那么谁能建议我怎么做那件事
下面是图片
你可以看到横幅在选项卡主机的下方
现在我想访问第一个 Activity 的横幅..... o
最佳答案
你可以做类似的事情。
- 将创建横幅的代码放入 TabActivity 并点击它。
- 仅在您想要的 Activity 中显示横幅,否则在其他 Activity 中将其可见性设置为“GONE”。
- 完成。
通过上面的解释,您可以只看到 Banner 或您想要的 Activity,并从该 Activity 中实现按钮的点击。
希望你明白我的意思。
欢迎提出任何意见。
关于android - 将横幅放在选项卡主机下方,仅用于一项 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14446606/