2016-02-25 43 views
-7

我想設計一個簡單的android應用程序,提示用戶輸入你想要的數字數,然後根據用戶需求動態創建文本框。任何一個給我提前如何在eclipse中動態創建文本框android

+2

不,我們不能爲你做你的工作。嘗試自己,然後回來,如果你有一個特定的問題,你需要幫助。 SO不是免費的代碼編寫服務。 – Takarii

+2

在android中有沒有'TextBox'? –

+1

可能他來自.NET ...我想他的意思是'EditText' –

回答

1

code.Thanks你問這個問題將很快被關閉,因爲偏離主題,但如果你想在次number添加TextView那麼不喜歡我會給你添加TextView OR EditText,小技巧這

LayoutParams lparams = new LayoutParams(
    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 

for(int i=0; i<number; i++) 
    TextView tv=new TextView(this); 
    tv.setLayoutParams(lparams); 
    tv.setText("TextView "+i); 
    this.myLayout.addView(tv); //Where mLayout is your Parent Layout 
}