Tôi đặt một ImageView và một VideoView trong RelativeLayout. ImageView có thể được thu nhỏ để lấp đầy toàn bộ bố cục theo scaleType="fitXY"
. Tuy nhiên, không có thuộc tính quy mô tương tự cho VideoView. Nhân tiện, tôi ẩn điều khiển video bằng cách đặt setMediaController(null)
và chỉ nội dung video hiển thị. Có thể quy mô VideoView mà không giữ tỷ lệ khung hình không? Đây là ví dụ bố cục.Android VideoView làm cách nào để mở rộng quy mô loại FitView theo quy mô ImageView?
<RelativeLayout
android:layout_width="280dp"
android:layout_height="200dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image"
android:scaleType="fitXY" />
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/video"
android:visibility="invisible"
android:layout_centerInParent="true" />
</RelativeLayout>
Cố gắng cho chiều rộng và chiều cao tĩnh. –
Nó không hoạt động. Tôi cố gắng đặt ' ' nhưng nhận được kết quả tỷ lệ co. –
Jones
bạn đã thử ans của tôi chưa? –