I listed how to auto-scroll text containers in C# while ago, and now that I am developing other applications for Android, I needed to do the same for the following:
TextView:
Rx_text is a TextView Container. and O_Text is a variable of type String
Rx_text.append(O_Text);
Rx_text_scroll_view.scrollTo(0, Rx_text.getBottom());
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
Friday, May 3, 2013
Friday, January 18, 2013
Android Development How to Set Focus
You ever need to set focus for a control on your GUI.
You could design a GUI interface for your Android application but, you need to set the focus to one specific control on start-up. In this example I am using a Button control for that. You have two options, option one: add the focus option in the xml file that describes your GUI, or option two: add the code that does the same thing in option one but can be used in run time instead of only once on start-up.
Option One:
Add this part to your xml GUI file
<Button
android:id="@+id/open_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open_comm"
android:onClick="onClick"
android:focusableInTouchMode="true"
>
<requestFocus/>
</Button>
Option Two:
Add this to the Activity module:
static Button Open_Button;
Open_Button = (Button) findViewById(R.id.open_bt);
Open_Button.setFocusableInTouchMode(true);
Open_Button.requestFocus();
More information will be added, and screen shots...
You could design a GUI interface for your Android application but, you need to set the focus to one specific control on start-up. In this example I am using a Button control for that. You have two options, option one: add the focus option in the xml file that describes your GUI, or option two: add the code that does the same thing in option one but can be used in run time instead of only once on start-up.
Option One:
Add this part to your xml GUI file
<Button
android:id="@+id/open_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open_comm"
android:onClick="onClick"
android:focusableInTouchMode="true"
>
<requestFocus/>
</Button>
Option Two:
Add this to the Activity module:
static Button Open_Button;
Open_Button = (Button) findViewById(R.id.open_bt);
Open_Button.setFocusableInTouchMode(true);
Open_Button.requestFocus();
More information will be added, and screen shots...
Subscribe to:
Posts (Atom)