У меня есть следующее представление, созданное с помощью CardView
.
Добавление зависимости compile 'com.android.support:cardview-v7:23.0.+'
в зависимость gradle
Ниже приведен XML-файл для того же.
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewEmp"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.50"
card_view:cardCornerRadius="20dp"
card_view:cardElevation="10dp"
android:padding="@dimen/margin_10"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
<ImageView
android:id="@+id/employeeIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/margin_5"
android:src="@drawable/employeeicon"
android:layout_centerHorizontal="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Employee"
android:layout_centerHorizontal="true"
android:layout_below="@+id/employeeIcon"
android:textSize="@dimen/textSizeNormal"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewVehicle"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.50"
card_view:cardCornerRadius="20dp"
card_view:cardElevation="10dp"
android:padding="@dimen/margin_10"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
<ImageView
android:id="@+id/vehicleIconLive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/margin_5"
android:src="@drawable/vehicleicon"
android:layout_centerHorizontal="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vehicle"
android:layout_centerHorizontal="true"
android:layout_below="@+id/vehicleIconLive"
android:textSize="@dimen/textSizeNormal"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
Теперь высота и внешний вид представления в мобильной версии 4.4.4 выглядят так, как показано ниже, что выглядит хорошо!
Но то же самое выглядит очень странно в 5.1.1 Nexus Tablet и 5.0.2 Mobile, как показано ниже.
Я добавил высоту и угловой радиус этим
card_view:cardCornerRadius="20dp"
card_view:cardElevation="10dp"
- Любой может ясно видеть, что угловой радиус выглядит странно без надлежащей высоты.
- В чем может быть проблема.
- Что можно сделать, чтобы CardView выглядел правильно?
Редактировать 1:
Пробовал с com.android.support:cardview-v7:23.1.1
, но результат снова был таким же.
compile 'com.android.support:cardview-v7:23.1.1'
- person IntelliJ Amiya   schedule 09.02.2016