我有一个有点复杂的布局,涉及多个片段,以及一个位于 GLView 顶部的片段中的 ListView。当我在屏幕上除列表视图之外的任何位置结束触摸(MotionEvent.ACTION_UP)时,列表视图行中的文本视图变为空白,调用 adapter.notifyDataSetChanged() 将刷新它们,但在下一次触摸时再次消失。
The relevant bits of the layout:
SlidingFragmentActivity
A SherlockFragment that fills the whole screen
RelativeLayout
A SherlockFragment containing LinearLayout, layout_width=WrapContent, layout_height=wrap_content, orientation=vertical
ImageButton, layout_width=WrapContent, layout_height=wrap_content
ListView(The problem view), layout_width=200, layout_height=wrap_content, background=transparent
Each row is a RelativeLayout containing several TextViews, with a semi-transparent background
TextView
ImageView
View that Overrides onDraw(Canvas) to do custom drawing
GLView - a Nutiteq MapView
每当 MotionEvent.ACTION_UP 发生时调用 adapter.notifyDatasetChanged() 会使问题变得不那么明显,但这似乎是一个浪费 CPU 时间的不优雅的解决方案。
几个说明问题的屏幕截图(右下角的列表视图)