我有一个简单的ListView,其中包含许多TextView。
当我通过此列表执行(类似)时,在Galaxy Tab 10.1“和Galaxy Tab 7”上,我注意到以下差异:
总而言之,这会导致更糟糕的表现(更少的重绘/项目滚动)
有关如何改善这一点的任何建议?
例如。我们可以控制(延长)投掷的持续时间吗?
我在
下添加了说明此行为的示例代码public class TestSwipe extends Activity
{
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
ListView t = new ListView(this);
t.setScrollingCacheEnabled(false);
t.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
t.setAdapter(new BaseAdapter()
{
public View getView(int position, View convertView, ViewGroup parent)
{
TextView t = new TextView(TestSwipe.this);
t.setText("TV: "+position);
return t;
}
public long getItemId(int position)
{
return 0;
}
public Object getItem(int position)
{
return null;
}
public int getCount()
{
return 10000;
}
});
t.setOnScrollListener(new OnScrollListener()
{
int ctr=0;
public void onScrollStateChanged(AbsListView view, int scrollState)
{
Log.d("TWINTV", "scrollState="+scrollState);
ctr=0;
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount)
{
Log.d("TWINTV", "onScroll="+ctr++);
}
});
setContentView(t);
}
}