<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- This FrameLayout is used to center the inner layout. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true"> <!-- Wraps everything in a card --> <androidx.car.widget.ColumnCardView android:id="@+id/card" android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="@color/contact_detail_card_background_color" android:layout_gravity="center"> <!-- Used to provide common margins and also allow for the textview to set its right margin to the width of the image to allow it to ellipsize. --> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="@dimen/contact_detail_name_card_height" android:layout_marginLeft="@dimen/car_keyline_1" android:layout_marginRight="@dimen/car_keyline_1"> <ImageView android:id="@+id/avatar" android:layout_width="@dimen/contact_detail_image_size" android:layout_height="@dimen/contact_detail_image_size" android:background="@drawable/avatar_rounded_bg" app:layout_constraintVertical_chainStyle="packed" app:layout_constraintBottom_toTopOf="@+id/title" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"/> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="end" android:layout_marginTop="@dimen/car_padding_4" style="@style/TextAppearance.Car.Body1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/avatar"/> </android.support.constraint.ConstraintLayout> <View android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="@dimen/car_list_divider_height" android:layout_marginStart="@dimen/car_keyline_1" android:layout_marginEnd="@dimen/car_keyline_1" android:background="@color/car_list_divider" android:layout_gravity="bottom"/> </androidx.car.widget.ColumnCardView> </FrameLayout>