ただいまボタンとテキストの交互に表示されるものを作りたいのですがエラーが出てしまいわかりません…
package c0114183.kakunin3;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.*;
public class kakunin3 extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.HORIZONTAL); setContentView(ll); TextView[] tv = new TextView[5]; Button[] bt = new Button[5]; for (int i = 0; i < tv.length; i++){ bt [i] = new Button(this); tv [i] = new TextView(this); bt[i] = new Button(this); tv[i] = new TextView(this); bt[i].setText(i); tv[i].setText("ボタン1"); ll.addView(bt[i]); ll.addView(tv[i]); } }
}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/15 07:51