0
我想動態添加textview。當我嘗試這樣做IAM越來越零點異常動態添加TextView導致空點異常
這是我的代碼片段:提前
LinearLayout layout = (LinearLayout) findViewById(R.layout.activity_main);
LayoutInflater Inflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View vs = (View) Inflater.inflate(R.layout.serverd_details, null);
TextView textView = (TextView) vs.findViewById(R.id.SerText);
textView.setText("server details");
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
layout.addView(textView, p);
謝謝...
發佈您的日誌... – Vamshi
從logcat發佈錯誤日誌 –