私の現在のコードは次のとおりです。アンドロイドで動的な水平テーブルの行を作成するには?
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
String b = json_data.getString("examnames");
JSONObject getexamnamesobject = new JSONObject(b);
getexamnames=getexamnamesobject.getString("types");
TableRow tr = new TableRow(this);
TextView tv1 = new TextView(this);
createView(tr,tv1,getexamnames);
t1.addView(tr);
}
public void createView(TableRow tr, TextView t, String viewdata) {
t.setText(viewdata);
//adjust the porperties of the textView
t.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
//t.setTextColor(Color.DKGRAY);
//t.setBackgroundColor(Color.CYAN);
t.setPadding(20, 0, 0, 0);
tr.setPadding(0, 1, 0, 1);
//tr.setBackgroundColor(Color.BLACK);
tr.addView(t); // add TextView to row.
}
上記のコード、私はこのような垂直textviewsを取得していているため私の出力:
English
Maths
Science
は何の水平を得るために上記のコードの変更でなければなりません
English Maths Science
私を助けてください。これは私にとって非常に重要です ありがとうございます事前に
私はコードで私を助けてください(私はjava&androidへの初心者です)。そして、これのためにアンドロイドによって提供される他の方法はありませんか? –