Scroll if an accessibility setting description does not fit the screen.
1. Certain accessibility settings are shown on a separate screen with
a toggle switch and a description. Sometimes the description does not
fit the screen. The preference framework is using a list view for
holding the description item. This list view was disabled, thus not
scrolling (done to avoid drawable state change on click). Now the
list view is enabled and the drawable state change on click problem
is solved by setting the selector and divider drawables to a
transparent one.
2. The layout for the list item that shows the feature description had
an unnecessary linear layout.
bug:8632146
Change-Id: Ib81a8513158d5b8d90fa80f57720c8590022ae1a
diff --git a/res/layout/text_description_preference.xml b/res/layout/text_description_preference.xml
index 7d73f58..78eb02a 100644
--- a/res/layout/text_description_preference.xml
+++ b/res/layout/text_description_preference.xml
@@ -14,18 +14,11 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/message_container"
- android:layout_width="match_parent"
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/summary"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorSecondary"
- android:padding="16dip" />
-
-</LinearLayout>
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ android:padding="16dip" />
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index 638aae6..a4438d0 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -32,6 +32,8 @@
import android.content.pm.ServiceInfo;
import android.content.res.Configuration;
import android.database.ContentObserver;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -427,11 +429,6 @@
@Override
protected void onBindView(View view) {
super.onBindView(view);
-
- LinearLayout containerView =
- (LinearLayout) view.findViewById(R.id.message_container);
- containerView.setGravity(Gravity.CENTER);
-
TextView summaryView = (TextView) view.findViewById(R.id.summary);
String title = getString(R.string.accessibility_no_services_installed);
summaryView.setText(title);
@@ -1030,8 +1027,9 @@
super.onViewCreated(view, savedInstanceState);
onInstallActionBarToggleSwitch();
onProcessArguments(getArguments());
+ // Set a transparent drawable to prevent use of the default one.
+ getListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
getListView().setDivider(null);
- getListView().setEnabled(false);
}
@Override