所以我之前遇到过这个问题,我自然就在这里寻求帮助.Luksprog的答案很棒,因为我不知道ListView和GridView如何通过回收视图优化自身.因此,根据他的建议,我能够改变将Grid添加到GridView的方式.问题是现在我有一些没有意义的事情.这是getView我的BaseAdapter:
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
convertView = inflater.inflate(R.layout.day_view_item, parent, false);
}
Log.d("DayViewActivity", "Position is: "+position);
((TextView)convertView.findViewById(R.id.day_hour_side)).setText(array[position]);
LinearLayout layout = (LinearLayout)convertView.findViewById(R.id.day_event_layout);
//layout.addView(new EventFrame(parent.getContext()));
TextView create = new TextView(DayViewActivity.this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 62, getResources().getDisplayMetrics()), 1.0f);
params.topMargin = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics());
params.bottomMargin = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics());
create.setLayoutParams(params);
create.setBackgroundColor(Color.BLUE);
create.setText("Test");
//the following is my original LinearLayout.LayoutParams for correctly setting the TextView Height …Run Code Online (Sandbox Code Playgroud) 什么是最大尺寸HashSet,Vector,LinkedList?我知道ArrayList可以存储超过3277000个数字.
但是列表的大小取决于内存(堆)大小.如果达到最大值,JDK会抛出一个OutOfMemoryError.
但我不知道元素数量的限制HashSet,Vector和LinkedList.
我是Android编程的新手.我想知道ListView可以存储多少项?我在文档中搜索,但他们没有谈论这个.如果我将很多(可能是10k)项目放入ListAdapter会对性能产生什么影响呢?
干杯,MK.