[Android] video: fix surface scaling & position

Sébastien Toque git at videolan.org
Sat May 18 19:44:07 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat May 18 19:34:16 2013 +0200| [50569afb6b620cdcf35be200a9ee61cff85cba26] | committer: Sébastien Toque

video: fix surface scaling & position

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=50569afb6b620cdcf35be200a9ee61cff85cba26
---

 vlc-android/res/layout/player.xml |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 2195d96..8b1146b 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -4,18 +4,25 @@
     android:layout_height="fill_parent"
     android:background="#000001" >
 
+    <!-- the double FrameLayout is necessary here to do cropping on the right
+     (which requires the surface not be centered), while keeping the result centered -->
     <FrameLayout
-        android:id="@+id/player_surface_frame"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerInParent="true"
-        android:foregroundGravity="clip_horizontal" >
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" >
 
-        <SurfaceView
-            android:id="@+id/player_surface"
+        <FrameLayout
+            android:id="@+id/player_surface_frame"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical" />
+            android:layout_gravity="center"
+            android:foregroundGravity="clip_horizontal" >
+
+            <SurfaceView
+                android:id="@+id/player_surface"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical" />
+        </FrameLayout>
     </FrameLayout>
 
     <TextView



More information about the Android mailing list