Focus on the first edtitext in android
I have four edittexts the p开发者_Go百科roblem is when i start activity the focus will be on the last edittext , how can i make the focus on the first edittext using xml ? Thanks
onCreate(); of Activity
EditText firsteditText=(EditText)findViewById(R.id.first);
EditText secondeditText=(EditText)findViewById(R.id.second);
EditText thirdeditText=(EditText)findViewById(R.id.third);
EditText fourtheditText=(EditText)findViewById(R.id.fourth);
firsteditText.requestFocus();
You can use the requestFocus element.
You can also add a <requestFocus/>
tab in the activity xml.
In Android Studio 2.3.3, you can click on the focusedByDefault attribute in the Properties panel on the EditText you want the focus on first.
精彩评论