[Android] [PATCH 4/4] cardview for directory browsing

Geoffrey Métais geoffrey.metais at gmail.com
Mon Nov 3 16:21:48 CET 2014


---
 vlc-android/res/layout/directory_view.xml      |  4 +--
 vlc-android/res/layout/directory_view_item.xml | 39 +++++++++++++++-----------
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/vlc-android/res/layout/directory_view.xml b/vlc-android/res/layout/directory_view.xml
index aac0724..cd7abe0 100644
--- a/vlc-android/res/layout/directory_view.xml
+++ b/vlc-android/res/layout/directory_view.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ListView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/list"
-    android:paddingLeft="20dp"
-    android:paddingRight="20dp"
+    android:paddingLeft="10dp"
+    android:paddingRight="10dp"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingBottom="@dimen/listview_bottom_padding"
diff --git a/vlc-android/res/layout/directory_view_item.xml b/vlc-android/res/layout/directory_view_item.xml
index 9283613..4efa8ad 100644
--- a/vlc-android/res/layout/directory_view_item.xml
+++ b/vlc-android/res/layout/directory_view_item.xml
@@ -1,30 +1,33 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<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/layout_item"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="horizontal" >
+    android:orientation="horizontal"
+    card_view:cardElevation="1dp"
+    card_view:cardUseCompatPadding="true" >
 
-    <ImageView
-        android:id="@+id/dvi_icon"
-        android:layout_width="@dimen/audio_browser_item_size"
-        android:layout_height="@dimen/audio_browser_item_size"
-        android:layout_gravity="center"
-        android:contentDescription="@string/cover_art"
-        android:src="@drawable/icon" />
-
-    <LinearLayout
+    <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:orientation="vertical"
-        android:paddingLeft="10dp" >
+        android:gravity="center_vertical" >
+
+        <ImageView
+            android:id="@+id/dvi_icon"
+            android:layout_width="@dimen/audio_browser_item_size"
+            android:layout_height="@dimen/audio_browser_item_size"
+            android:layout_gravity="left"
+            android:layout_marginRight="10dp"
+            android:contentDescription="@string/cover_art"
+            android:src="@drawable/icon" />
 
         <TextView
             android:id="@+id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
+            android:layout_toRightOf="@+id/dvi_icon"
             android:ellipsize="marquee"
             android:marqueeRepeatLimit="marquee_forever"
             android:singleLine="true"
@@ -36,11 +39,13 @@
             android:id="@+id/text"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_below="@id/title"
+            android:layout_toRightOf="@+id/dvi_icon"
             android:ellipsize="marquee"
             android:maxLines="1"
             android:text="@string/artist"
             android:textColor="?attr/list_subtitle"
             android:textSize="14sp" />
-    </LinearLayout>
+    </RelativeLayout>
 
-</LinearLayout>
\ No newline at end of file
+</android.support.v7.widget.CardView>
\ No newline at end of file
-- 
1.9.1



More information about the Android mailing list