这是我的布局,它是一个信息窗口,在需要向用户显示新信息时显示。
布局应该占据整个屏幕,并带有一些透明的背景颜色,以及一个小的文本布局:
我正在将此布局添加到另一个ViewGroup中,代码如下:
这段代码将信息窗口添加到其根视图容器的最后一个索引中。
结果中我只看到包含文本的第二个RelativeLayout,但我没有看到透明的父级根布局...
有任何想法为什么会这样?
更新: 这是我的容器:
布局应该占据整个屏幕,并带有一些透明的背景颜色,以及一个小的文本布局:
<?xml version="1.0" encoding="utf-8"?>
<!-- info fragment - used by the fragment to provide info on a specific fragment -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.coapps.pico"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_dark_green" >
//this is the only layout i see in the result. not it's parent's layout...
<RelativeLayout
android:id="@+id/fragment_info_relativelayout_info"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_alignParentTop="true"
android:background="@drawable/background_info_window"
android:clickable="true" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:layout_margin="5dp" >
<!-- The info textView -->
<com.coapps.pico.NillanTextView
android:id="@+id/fragment_info_textview_info"
style="@style/text_shadow_black"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="left"
android:text="Some Text "
android:textColor="@android:color/white"
app:isBold="true" />
</ScrollView>
<!-- Tap to close -->
<com.coapps.pico.NillanTextView
android:id="@+id/fragment_info_textview_tap_to_close"
style="@style/text_shadow_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingRight="5dp"
android:text="@string/button_tap_to_close"
android:textColor="@android:color/white"
app:isBold="true" />
</RelativeLayout>
</RelativeLayout>
我正在将此布局添加到另一个ViewGroup中,代码如下:
/**
* Show the info window
*/
public void show()
{
//if the window is not visible
if (!isVisible())
//add window's view
rootView.addView(infoWindowView);
}
这段代码将信息窗口添加到其根视图容器的最后一个索引中。
结果中我只看到包含文本的第二个RelativeLayout,但我没有看到透明的父级根布局...
有任何想法为什么会这样?
更新: 这是我的容器:
<?xml version="1.0" encoding="utf-8"?>
<!-- This is the main layout of the application -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_basic_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</RelativeLayout>