当我调用addView大约80次时,app会自动关闭,我该如何解决?
MainActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout l = new LinearLayout(this);
for (int i = 0; i < 80; i++)
l.addView(new MyTextView(this));
setContentView(l);
}
MyTextView
public class MyTextView extends TextView {
public MyTextView(Context context) {
super(context);
// TODO Auto-generated constructor stub
setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/default.ttf"));
setTextSize(20);
}
}