【发布时间】:2012-02-29 17:49:28
【问题描述】:
我猜它很简单,可能是列表视图或片段中的设置。 但是我现在几个小时都找不到解决方案。 所以.. 我有一个这样的列表视图
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fffafa"
/>
</RelativeLayout>
当有人点击列表项时。我用这样的片段替换它
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction ft = manager.beginTransaction();
ft.replace(R.id.content, newFragment);
ft.addToBackStack(null);
ft.commit();
如果我单击列表上的项目,整个列表将替换为由一个按钮和几个文本字段组成的片段(*)。 Fragment 用有关项目的信息正确替换了 listView。当我按下返回时,它确实会正确地返回列表视图。
问题是,如果我点击 * 的背景,它的行为就像我点击它后面的列表一样......并将关于该项目的片段带到前面。我可以无休止地点击背景以带来其他片段。我可以通过点击返回,返回来挖掘列表。
为什么这个片段是透明的?我该如何解决这个问题?
【问题讨论】:
标签: android android-listview android-fragments