Skip to content

Commit

Permalink
example: Use a scrollable TextView instead of an EditText field
Browse files Browse the repository at this point in the history
The EditText field pops up the keyboard at inopportune moments.  This
will become a usability problem when we add buttons to the interface.

Signed-off-by: Jorrit Jongma <[email protected]>
  • Loading branch information
cernekee authored and Chainfire committed Jul 31, 2013
1 parent e7dacc4 commit e3d980b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
27 changes: 20 additions & 7 deletions libsuperuser_example/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/text"
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:inputType="textMultiLine" >
android:layout_height="0dp"
android:layout_weight="1" >

<requestFocus />
</EditText>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="none" />

</LinearLayout>
</ScrollView>

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
private class Startup extends AsyncTask<Void, Void, Void> {
Expand Down Expand Up @@ -90,7 +90,7 @@ protected void onPostExecute(Void result) {
sb.append(line).append((char)10);
}
}
((EditText)findViewById(R.id.text)).setText(sb.toString());
((TextView)findViewById(R.id.text)).setText(sb.toString());
}
}

Expand Down

0 comments on commit e3d980b

Please sign in to comment.