0

Перерыл весь google, есть решения, но, или лыжи не едут, или я не догоняю - моя проблема не решается. В приложении есть splash_screen_activity, в нем планируется проигрывать рекламные видеоролики или статичные картинки.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/adImage"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/lingua_plus_banner"
        android:layout_gravity="center"
        android:contentDescription="LinguaPlus"
        android:visibility="gone"/>

    <VideoView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/adVideo"
        android:visibility="gone" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/skip"
        android:src="@drawable/ic_action_closead"
        android:tint="@color/accent"
        android:layout_gravity="right|top"
        android:layout_margin="12dip"
        android:onClick="skip"
        android:visibility="invisible"/>

</FrameLayout>

Подскажите, какие layout параметры нужно использовать для FrameLayout и VideoView для корректного масштабирования видеороликов, в ландшафтной и портретной ориентации? Какие пропорции должны быть у видеороликов? Разрешение? Что нужно сделать, чтобы видеоролики не отображались вот так - введите сюда описание изображения введите сюда описание изображения

UPD

Так выглядит на экране видео после выставления атрибутов match_parent у FrameLayout. Также оно выглядит при такой разметке:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<VideoView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:id="@+id/adVideo"
        android:visibility="gone" /> 

введите сюда описание изображения введите сюда описание изображения

2
  • Атрибут match_parent?
    – user194625
    5 дек 2016 в 10:18
  • Обновил вопрос, посмотрите результат 5 дек 2016 в 10:27

1 ответ 1

0

Все решило layout_gravity="center"

<FrameLayout 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
    <VideoView 
        android:id="@+id/videoView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_gravity="center" />
    </FrameLayout>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.