preference_material.xml revision 416387763cbaffdc64dd43c74c71b3e672a3a565
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2014 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16
17<!-- Layout for a Preference in a PreferenceActivity. The
18     Preference is able to place a specific widget for its particular
19     type in the "widget_frame" layout. -->
20<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
21    android:layout_width="match_parent"
22    android:layout_height="wrap_content"
23    android:minHeight="?attr/listPreferredItemHeightSmall"
24    android:gravity="center_vertical"
25    android:paddingStart="?attr/listPreferredItemPaddingStart"
26    android:paddingEnd="?attr/listPreferredItemPaddingEnd"
27    android:background="?attr/activatedBackgroundIndicator"
28    android:clipToPadding="false">
29
30    <LinearLayout
31        android:id="@+id/icon_frame"
32        android:layout_width="wrap_content"
33        android:layout_height="match_parent"
34        android:layout_marginStart="-4dp"
35        android:minWidth="60dp"
36        android:gravity="start|center_vertical"
37        android:orientation="horizontal"
38        android:paddingEnd="12dp"
39        android:paddingTop="4dp"
40        android:paddingBottom="4dp">
41        <ImageView
42            android:id="@+id/icon"
43            android:layout_width="wrap_content"
44            android:layout_height="wrap_content"
45            android:maxWidth="48dp"
46            android:maxHeight="48dp" />
47    </LinearLayout>
48
49    <RelativeLayout
50        android:layout_width="wrap_content"
51        android:layout_height="wrap_content"
52        android:layout_weight="1"
53        android:paddingTop="16dp"
54        android:paddingBottom="16dp">
55
56        <TextView android:id="@+id/title"
57            android:layout_width="wrap_content"
58            android:layout_height="wrap_content"
59            android:singleLine="true"
60            android:textAppearance="?attr/textAppearanceListItem"
61            android:ellipsize="marquee" />
62
63        <TextView android:id="@+id/summary"
64            android:layout_width="wrap_content"
65            android:layout_height="wrap_content"
66            android:layout_below="@id/title"
67            android:layout_alignStart="@id/title"
68            android:textAppearance="?attr/textAppearanceListItemSecondary"
69            android:textColor="?attr/textColorSecondary"
70            android:maxLines="10" />
71
72    </RelativeLayout>
73
74    <!-- Preference should place its actual preference widget here. -->
75    <LinearLayout android:id="@+id/widget_frame"
76        android:layout_width="wrap_content"
77        android:layout_height="match_parent"
78        android:gravity="end|center_vertical"
79        android:paddingStart="16dp"
80        android:orientation="vertical" />
81
82</LinearLayout>
83