私は相対レイアウトとtextviewsとedittextの 'n'個の番号を持っています。私は整列をしたいダイナミックに作成されたテキストビューとアンドロイドでテキストを編集する
TextView EditText
Button
TextView EditText
Button
TextView EditText
Button
TextView EditText
Button
..........
私はレイアウトパラメータを使用しようとしましたが、私は奇妙な結果を得ています。ここ は私のコードは、私がこのようなlayout_paramsを適用しているが、それは助けていない、テキスト編集..
final EditText[] editTextarray = new EditText[41];
for (int i = 0; i < 41; i++) {
// create a new textview
final EditText editText = new EditText(this);
RelativeLayout.LayoutParams paramsB = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
editText.setText("edit");
editText.setCursorVisible(true);
relativeLayout.addView(editText, paramsB);
editTextarray[i] = editText;
}
については
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.linearlayoutid);
final TextView[] myTextViews = new TextView[41];
for (int i = 0; i < 41; i++) {
// create a new textview
rowTextView = new TextView(this);
RelativeLayout.LayoutParams paramsA = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsA.addRule(RelativeLayout.RIGHT_OF, rowTextView.getId());
rowTextView.setId(i);
// add the textview to the layout
relativeLayout.addView(rowTextView, paramsA);
myTextViews[i] = rowTextView;
}
です。どんな助けも素晴らしいだろう!ありがとう
なぜここで線形レイアウトを使用しませんでしたか? –
paramsを使わずに線形レイアウトを使用しますか?その動的に生成されます。線形レイアウトはどのようにすることができますか?それは約100の編集テキストを動的に生成します@SohailZahid – Anusha
あなたが相対的なレイアウトプロパティを使用していない場合、単純に線形レイアウトをオリエンテーションで使います。 –