How to Place TextView and EditText on same line without using xml?




  • I used xml and very much familiar with xml only for layouts.

  • I am trying to code in activity and want to develop view like,


textview editetxt


textview edittext


textview edittext button


LinearLayout lLayout = (LinearLayout)findViewById(R.id.linearLayout);


TextView textViewName = new TextView (MainActivity.this); textViewName .setText("Name:");


Edittext editTextName= new Edittext (MainActivity.this);


lLayout.addView(textViewName ); lLayout.addView(editTextName);



  • It will obviously come vertical, but how to place horizontal...

  • I searched but not got any solution. I tried but, I don't know how to place vertical layout first and inside of it horizontal... -please help me to sort out this issue if any one knows... -Thank you in advance...


No comments:

Post a Comment