Chơi với Android Support Library
tiện ích v7 CardView
Tôi thấy các kết quả khác nhau trên Galaxy S4 so với thiết bị Nexus 4. Có cách bố trí như sau:Kết quả khác nhau của CardView của Thư viện hỗ trợ Android trên các thiết bị khác nhau
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
card_view:cardCornerRadius="7dp"
card_view:cardElevation="12dp">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true">
<TextView
android:id="@+id/txtExample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_messages" />
</ScrollView>
</android.support.v7.widget.CardView>
Tôi đã nhận những kết quả:
Nexus 4 (5.0.1):
Samsung Galaxy S4 (4.4.2):
Có vẻ như trên Nexus tính toán Chế độ xem với các lề của nó và sau đó là vẽ bóng bên ngoài. Mặt khác, một trong những Samsung dường như áp dụng lề và sau đó sơn bóng tối bên trong cho đến khi nó đạt đến giới hạn của Xem được tính toán.
Tôi có thiếu gì đó không?
Bạn đã đúng Maciej! Chúc mừng – GoRoS