Ok I have my main.xml defined like:
<LinearLayout android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<EditText android:text="EditText" android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="175px"></EditText>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_marginLeft="100px">
<Button android:id="@+id/button1" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:text="@string/btnPrint"></Button>
<Button android:id="@+id/button2" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:text="@string/btnCancel"></Button>
</LinearLayout>
</LinearLayout>
I want to be able to update the EditText’s cursor position from code before the call to setContentView(R.layout.main), is this possible? If not, what is the xml attribute for setting the cursor position of an EditText View?
Thanks,
Justin
You won’t be able to manipulate your view from the java side before your setContentView() call, because findViewById(R.id.yourView) will return null unless the view in question is actually on the screen. Is there a reason you don’t want to do it like this?
Although the cursor will technically move after its visible, it is going to be so fast that users are unlikely to notice.