0

I am pretty new to android UI concepts, i can easily create the edit text thorugh UI xml, and i can place the editText whereever i want in the screen. But at the same time is it possible to locate the edit text in specific given location throgh programmatically.

4

1 回答 1

2

这是通过Java代码生成edittext的代码

EditText edTxt = new EditText(this);

        edTxt.setInputType(InputType.TYPE_CLASS_TEXT);
        edTxt.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT));
        edTxt.setHint("Enter data");
        myLayout.addView(edTxt);
于 2012-11-28T10:28:58.737 回答