[Android] Preferences: Add a ScrollView to prevent overflow

Edward Wang git at videolan.org
Tue Nov 13 05:37:09 CET 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Mon Nov 12 23:35:52 2012 -0500| [d30edfc48784657aaabd0b2cbdfa9bfcb6bf2254] | committer: Edward Wang

Preferences: Add a ScrollView to prevent overflow

Resolves a usability bug.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d30edfc48784657aaabd0b2cbdfa9bfcb6bf2254
---

 vlc-android/res/layout/root_selection.xml          |   62 ++++++++++++--------
 .../org/videolan/vlc/gui/PreferencesActivity.java  |    2 +
 2 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/vlc-android/res/layout/root_selection.xml b/vlc-android/res/layout/root_selection.xml
index 16ce22b..10ae977 100644
--- a/vlc-android/res/layout/root_selection.xml
+++ b/vlc-android/res/layout/root_selection.xml
@@ -10,37 +10,51 @@
         android:focusable="true" android:focusableInTouchMode="true"
         android:layout_width="0px" android:layout_height="0px" />
 
-    <RadioGroup
-        android:id="@+id/radiogroup"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
+    <ScrollView
+        android:id="@+id/scrollView1"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1">
 
-        <RadioButton
-            android:id="@+id/internal_memory"
-            android:layout_width="wrap_content"
+        <LinearLayout
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:text="@string/internal_memory"
-            android:focusable="true" />
+            android:orientation="vertical">
 
-        <RadioButton
-            android:id="@+id/other"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:focusable="true"
-            android:text="@string/other"
-            android:tag="other" />
-    </RadioGroup>
+            <RadioGroup
+                android:id="@+id/radiogroup"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
 
-    <EditText
-        android:id="@+id/other_path"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:inputType="textNoSuggestions">
-    </EditText>
+                <RadioButton
+                    android:id="@+id/internal_memory"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:focusable="true"
+                    android:text="@string/internal_memory" />
+
+                <RadioButton
+                    android:id="@+id/other"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:focusable="true"
+                    android:tag="other"
+                    android:text="@string/other" />
+            </RadioGroup>
+
+            <EditText
+                android:id="@+id/other_path"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:inputType="textNoSuggestions">
+            </EditText>
+        </LinearLayout>
+    </ScrollView>
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content" >
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
 
         <Button
             android:id="@+id/ok"
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index 848cacc..a83f3c2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -49,6 +49,7 @@ import android.preference.PreferenceActivity;
 import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.View;
+import android.view.ViewGroup.LayoutParams;
 import android.widget.Button;
 import android.widget.CompoundButton;
 import android.widget.RadioButton;
@@ -82,6 +83,7 @@ public class PreferencesActivity extends PreferenceActivity {
                 final Dialog dialog = new Dialog(PreferencesActivity.this);
                 dialog.setContentView(R.layout.root_selection);
                 dialog.setCancelable(true);
+                dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
                 dialog.setTitle(R.string.filebrowser_root);
 
                 ArrayList<String> extMounts = new ArrayList<String>();



More information about the Android mailing list