Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force FullScreen on EditText in Android

I am currently developing an app with Samsung Galaxy Tab 2 as my device.

My Code in the XML is:

<EditText
    android:id="@+id/analysis_text"
    style="@style/icon_text"
    android:imeOptions="actionDone"
    android:inputType="textMultiLine"
    android:onClick="onBtnClicked"
/>

When this code executes, the full screen data entry mode (Extract Mode) is triggered automatically only in certain situations.

I would like my users to get a full data entry screen while editing text in this control, regardless of the screen or positioning of the control.

Another rephrase of this question: How do I force full screen data entry mode for EditText boxes in my activity no matter what the content is?

like image 728
skv Avatar asked Dec 26 '12 06:12

skv


1 Answers

I solved this issue, not really solved, but found a valid work-around.

The workaround is that I designed a text editor (which looks similar to the fullscreen UI) and on click of each of those EditBoxes the new UI activity is triggerred (with the startActivityForResult() so that once they are completed control is handed back to the calling activity) and after completion of edit the text is transferred back into the main screen.

I also ensured that those boxes which transfer the control do not take focus so that they immediately transfer control to the new UI.

This way I have been able to implement a cancel button, which now actually allows the user to go back without saving the changes he accidentally makes.

I am open to new ideas, but this has worked for me.

Code in Activity:

public void onBtnClicked(View v) {
    EditText current_text_box = (EditText) v;

    Intent intent = new Intent(ObservationActivity.this,
            TexteditorActivity.class);
    intent.putExtra("start_text", current_text_box.getText().toString());
    intent.putExtra("start_position", current_text_box.getSelectionStart());
    startActivityForResult(intent, v.getId());
} 

Code in XML:

<EditText
    android:id="@+id/observation_text"
    style="@style/icon_text"
    android:focusable="false"
    android:imeOptions="flagNoExtractUi"
    android:inputType="textMultiLine"
    android:onClick="onBtnClicked" >
</EditText>

To create the full screen UI I used code, you can use any like (http://android-richtexteditor.googlecode.com/)

like image 177
skv Avatar answered Sep 20 '22 14:09

skv