2016-07-14 5 views
-1

Я реализую просмотр видео в recycleview с эскизами после щелчка на списке просмотра видео, чтобы воспроизвести конкретный вид в следующем окне.как показать videoview в recycleview с thumbail в android

Но миниатюра не отображается, и видео автоматически запускается, я не знаю, как это сделать.

Любой знает, как это возможно? Поделитесь своими мыслями

ответ

0

Я думаю, ваша проблема связана с макетом.

Создать video_playing_with_thumbnail.xml

 Add this in layout xml 

     **** 
      <FrameLayout 
       android:layout_width="match_parent" 
       android:layout_height="fill_parent" 
       > 

       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <LinearLayout 
         android:id="@+id/linearlayout_video" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="9"> 

         <LinearLayout 
          android:id="@+id/laywork" 
          android:layout_width="match_parent" 
          android:layout_height="0dp" 
          android:layout_weight="7" 
          android:gravity="center"> 

          <VideoView 
           android:id="@+id/displayer" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_gravity="center_horizontal" 
           android:scaleType="fitXY" /> 

         </LinearLayout> 
         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="0dp" 
          android:layout_weight="2"> 

          <android.support.v7.widget.RecyclerView 
           android:id="@+id/listphotosrecyclerView" 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" 
           android:orientation="horizontal" /> 
         </LinearLayout> 
        </LinearLayout> 
      </RelativeLayout> 

    </FrameLayout> 
**** 


for thumbnail showing in recyclerView you can do: 

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

    <android.support.v7.widget.CardView 
     android:id="@+id/card_view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginRight="5dp"> 

     <RelativeLayout 
      android:layout_width="100dp" 
      android:layout_height="wrap_content"> 

      <RelativeLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@android:color/white" 
       android:padding="10dp"> 

       <VideoView 
        android:id="@+id/videoView" 
        android:layout_width="100dp" 
        android:layout_height="80dp" 
        /> 

       <ImageView 
        android:id="@+id/deleteVideo" 
        android:layout_width="30dp" 
        android:layout_height="30dp" 
        android:layout_alignParentRight="true" 
        android:layout_marginTop="50dp" 
        android:src="@drawable/cross_" 
        android:visibility="gone" /> 
      </RelativeLayout> 


     </RelativeLayout> 
    </android.support.v7.widget.CardView> 

</RelativeLayout> 

Затем создайте пользовательский класс адаптера, чтобы щелкнуть по пиктограмме и показать в большом одном представлении.

+0

Я определяю на recycleview в действии и определяю пользовательский макет для элемента (видео, просмотр изображения) – sumeet

+0

Я хочу реализовать recyclewview как youtube player click on view показать полный просмотр – sumeet

+0

u хочу сказать создать видеообъявление с recycleview и индивидуальным представлением элементов – sumeet