
The CardView extends FrameLayout. This layout has some problems with margins: http://stackoverflow.com/questions/5401952/framelayout-margin-not-working. These can be overcome in most situations by swithcing from a margin to some padding on the child view. The reason it is okay to do this in most cases is because the child view is usually a layout such as a ConstraintLayout anyway. For such cases, the difference between margin and padding is not much different, because there are usually not any background colours or borders applied (where padding vs margin would usually make a difference).
58 lines
2.5 KiB
XML
58 lines
2.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
xmlns:tools="http://schemas.android.com/tools"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="220dp"
|
|
android:foreground="?attr/selectableItemBackground"
|
|
android:clickable="true">
|
|
|
|
<android.support.constraint.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:padding="8dp">
|
|
|
|
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
|
when it will inevitably read out the name of the app straight after. -->
|
|
<ImageView
|
|
android:id="@+id/icon"
|
|
android:layout_width="96dip"
|
|
android:layout_height="96dip"
|
|
tools:src="@drawable/ic_launcher"
|
|
android:scaleType="fitCenter"
|
|
android:layout_marginEnd="16dp"
|
|
android:layout_marginRight="16dp"
|
|
android:layout_marginStart="16dp"
|
|
android:layout_marginLeft="16dp"
|
|
android:layout_marginTop="8dp"
|
|
android:layout_marginBottom="8dp"
|
|
app:layout_constraintRight_toRightOf="parent"
|
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
tools:ignore="ContentDescription" />
|
|
|
|
<TextView
|
|
tools:text="F-Droid An application summary which takes up too much space and must ellipsize"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:id="@+id/summary"
|
|
android:maxLines="4"
|
|
android:textSize="14sp"
|
|
android:ellipsize="end"
|
|
app:layout_constraintTop_toBottomOf="@+id/icon"
|
|
app:layout_constraintRight_toRightOf="parent"
|
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
android:layout_marginTop="8dp" />
|
|
|
|
<include layout="@layout/app_status_new"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:id="@+id/new_tag"
|
|
android:layout_marginTop="4dp"
|
|
app:layout_constraintTop_toBottomOf="@+id/summary"
|
|
app:layout_constraintStart_toStartOf="@+id/summary"
|
|
app:layout_constraintLeft_toLeftOf="@+id/summary" />
|
|
|
|
</android.support.constraint.ConstraintLayout>
|
|
|
|
</android.support.v7.widget.CardView> |