Android 正在膨胀ListView,第二次变得透明
在主布局中,我有一个内部有两个ListView的ViewFlipper,下面是一个摘录Android 正在膨胀ListView,第二次变得透明,android,listview,transparency,Android,Listview,Transparency,在主布局中,我有一个内部有两个ListView的ViewFlipper,下面是一个摘录 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/chinese_background"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
[...]
<ViewFlipper
android:id="@+id/vFlipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/textStatus"
android:layout_below="@+id/buttonSearch" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/lstVocab01"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/lstVocab02"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</ViewFlipper>
[...]
[……]
但是:第一个ListView很容易看到。第二个视图有一种alpha透明度,即使强制alpha为1,我也无法删除它
请不要说:
- 代码的其余部分工作正常,ListView每次都用正确的数据更新
- 这不是ViewFlipper的问题,我以前在运行时替换ListView时也遇到过这个问题
- 如果在另一个活动中使用第二个ListView,则不会出现此问题
- 该问题与Android版本/设备无关(在三星SPlus 2.3.6、SIII 4+、Emulator 4.3.0上试用)
我不知道该试什么了。如果需要,请向我询问更多详细信息。您可以在这里发布您的动画XML文件吗?当然可以。这4个动画xml文件取自本例(未做任何修改):但我想再次强调一下,在实现ViewFLipper之前,我有相同的动画xml文件。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textLine01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textSize="@dimen/text_big" />
<TextView
android:id="@+id/textLine02"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="@dimen/text_normal" />
</LinearLayout>
adapter_c.changeCursor(cursor);
adapter_c.notifyDataSetChanged();
if (viewFlipper.getDisplayedChild() == 1) {
viewFlipper.setInAnimation(this, R.anim.in_from_left);
viewFlipper.setOutAnimation(this, R.anim.out_to_right);
viewFlipper.showPrevious();
}
adapter_e.changeCursor(cursor);
adapter_e.notifyDataSetChanged();
if (viewFlipper.getDisplayedChild() == 0) {
viewFlipper.setInAnimation(this, R.anim.in_from_right);
viewFlipper.setOutAnimation(this, R.anim.out_to_left);
viewFlipper.showNext();
}