은이 같은 레이아웃 무게를 사용해보십시오 :
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textview1"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1">
</TextView>
<EditText
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
</TableRow>
프로그래밍을하려면,이 같은 동일하게 수행의 LayoutParams를 사용해보십시오 :
내가 생각 answers.i의를 물어 당신의 코멘트를보고
TableLayout table = (TableLayout) findViewById(R.id.TableLayout1);
TableRow tr = new TableRow(this);
TableLayout.LayoutParams trparams = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT);
tr.setLayoutParams(trparams);
textview1 = new TextView(this);
edittext1 = new EditText(this);
TableRow.LayoutParams fieldparams = new TableRow.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f);
tr.addView(textview1, fieldparams);
tr.addView(edittext1, fieldparams);
table.addView(tr);
출처
2012-02-01 05:53:19
ask
보여 코드. 그래서 어떤 사람도 당신을 도와 줄 수 있습니다 –
당신이 android를 사용할 수있는 캐릭터를 제한하고 싶다면 : maxLength = "10" –
@AndroidTechMe 제 코드가 'ask'가 제안한 것입니다. – iuq