1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright (C) 2017 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 <!-- This FrameLayout is used to center the inner layout. --> 17 <FrameLayout 18 xmlns:android="http://schemas.android.com/apk/res/android" 19 xmlns:app="http://schemas.android.com/apk/res-auto" 20 android:layout_width="match_parent" 21 android:layout_height="wrap_content" 22 android:focusable="true"> 23 24 <!-- Wraps everything in a card --> 25 <androidx.car.widget.ColumnCardView 26 android:id="@+id/card" 27 android:layout_width="wrap_content" 28 android:layout_height="wrap_content" 29 android:backgroundTint="@color/contact_detail_card_background_color" 30 android:layout_gravity="center"> 31 32 <!-- Used to provide common margins and also allow for the textview to set its right margin 33 to the width of the image to allow it to ellipsize. 34 --> 35 <android.support.constraint.ConstraintLayout 36 android:layout_width="match_parent" 37 android:layout_height="@dimen/contact_detail_name_card_height" 38 android:layout_marginLeft="@dimen/car_keyline_1" 39 android:layout_marginRight="@dimen/car_keyline_1"> 40 41 <ImageView 42 android:id="@+id/avatar" 43 android:layout_width="@dimen/contact_detail_image_size" 44 android:layout_height="@dimen/contact_detail_image_size" 45 android:background="@drawable/avatar_rounded_bg" 46 app:layout_constraintVertical_chainStyle="packed" 47 app:layout_constraintBottom_toTopOf="@+id/title" 48 app:layout_constraintStart_toStartOf="parent" 49 app:layout_constraintEnd_toEndOf="parent" 50 app:layout_constraintTop_toTopOf="parent"/> 51 52 <TextView 53 android:id="@+id/title" 54 android:layout_width="wrap_content" 55 android:layout_height="wrap_content" 56 android:singleLine="true" 57 android:ellipsize="end" 58 android:layout_marginTop="@dimen/car_padding_4" 59 style="@style/TextAppearance.Car.Body1" 60 app:layout_constraintBottom_toBottomOf="parent" 61 app:layout_constraintStart_toStartOf="parent" 62 app:layout_constraintEnd_toEndOf="parent" 63 app:layout_constraintTop_toBottomOf="@+id/avatar"/> 64 </android.support.constraint.ConstraintLayout> 65 <View 66 android:id="@+id/divider" 67 android:layout_width="match_parent" 68 android:layout_height="@dimen/car_list_divider_height" 69 android:layout_marginStart="@dimen/car_keyline_1" 70 android:layout_marginEnd="@dimen/car_keyline_1" 71 android:background="@color/car_list_divider" 72 android:layout_gravity="bottom"/> 73 </androidx.car.widget.ColumnCardView> 74 </FrameLayout> 75