From e3d980b36ab294fc01c062f8cb2eaa1e7844b9b0 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 4 Jul 2013 12:51:26 -0700 Subject: [PATCH] example: Use a scrollable TextView instead of an EditText field 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 --- .../res/layout/activity_main.xml | 27 ++++++++++++++----- .../libsuperuser_example/MainActivity.java | 4 +-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/libsuperuser_example/res/layout/activity_main.xml b/libsuperuser_example/res/layout/activity_main.xml index e05ab21..1023b33 100644 --- a/libsuperuser_example/res/layout/activity_main.xml +++ b/libsuperuser_example/res/layout/activity_main.xml @@ -1,15 +1,28 @@ + android:layout_height="fill_parent" + android:orientation="vertical" > - + android:layout_height="0dp" + android:layout_weight="1" > - - + + + + + + diff --git a/libsuperuser_example/src/eu/chainfire/libsuperuser_example/MainActivity.java b/libsuperuser_example/src/eu/chainfire/libsuperuser_example/MainActivity.java index 666bba5..cc35cdf 100644 --- a/libsuperuser_example/src/eu/chainfire/libsuperuser_example/MainActivity.java +++ b/libsuperuser_example/src/eu/chainfire/libsuperuser_example/MainActivity.java @@ -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 { @@ -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()); } }