2016-08-05 4 views
-3

in Fragment eines iam displpablying ein videoview und es enthält einen Knopf. Wenn wir auf die Schaltfläche klicken, navigiert es zum nächsten Videofragment, das in den Status onPause übergegangen ist. zweites Fragment enthält eine Liste von Videoansichten, wenn wir spielen und ein Scrollen des ersten Fragments durchführen. videoview thumb image ersetzt das zweite fragment beim scrollen. was tue ich, um das nicht in das nächste fragment zu lassen?Overlaping Video Daumen eines Fragments in einem anderen Fragment Videoansicht in Scrolling

mein Code

wenn ich eine nächste Taste in dem ersten Fragmente getan Ich schreibe einen Code wie diese

  if (videoview.isPlaying()) { 
       try { 

        videoview.pause(); 
        youtube_view.onPause(); 
        youtube_view.stopLoading(); 
        imgv_videoimage.setVisibility(View.VISIBLE); 
        image_view_thumb.setVisibility(View.GONE); 
        rel_video.setVisibility(View.GONE); 
        youtube_view.setVisibility(View.GONE); 
        videoview.setVisibility(View.GONE); 
        img_play_icon_image.setVisibility(View.VISIBLE); 
       } catch (Exception e) { 
        e.printStackTrace(); 
       } 
      } 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 

     profilepic_clicked = "ProfileClicked"; 
     Profile fragment = new Profile(); 
     bundle.putString("Tweak_Userid", str_persionuserid); 
     fragment.setArguments(bundle); 
     FragmentManager fragmentManager = (getActivity()).getFragmentManager(); 
     FragmentTransaction ft = fragmentManager 
       .beginTransaction(); 
     ft.add(R.id.home_container, fragment); 
     ft.addToBackStack(VideoDetailFragment.class 
       .getName()); 
     ft.commit(); 
     SharedPreferences.Editor editor=prefs.edit(); 
     editor.putString("TweakUserid", str_persionuserid); 
     editor.commit(); 
     category = false; 
     try { 
      youtube_view.onPause(); 
      youtube_view.stopLoading(); 
      progressbar.setVisibility(View.GONE); 
      rel_video.setVisibility(View.GONE); 
      imgv_videoimage.setVisibility(View.VISIBLE); 
      img_play_icon_image.setVisibility(View.VISIBLE); 
      img_play_icon.setVisibility(View.GONE); 
      youtube_icon.setVisibility(View.GONE); 
      ll_andout_video.setVisibility(View.INVISIBLE); 
      ll_youtube.setVisibility(View.GONE); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 

diese Datei meiner zweite Fragment-Layouts ist

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/white" 
      android:clickable="true" 
     > 
     <RelativeLayout 
      android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
       <RelativeLayout 
        android:id="@+id/navbar" 
        android:layout_width="fill_parent" 
        android:layout_height="76dp" 

        android:visibility="visible" 
        > 
     <LinearLayout 
      android:id="@+id/ll_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:background="@drawable/statusbar"></LinearLayout> 
     <View 
      android:id="@+id/line" 
      android:layout_width="match_parent" 
      android:layout_height="2dp" 
      android:background="#ffff01" 
      android:layout_below="@+id/ll_view"/> 

     <LinearLayout 
      android:id="@+id/ll_back_button" 
      android:layout_width="50dp" 
      android:layout_height="50dp" 
      android:visibility="gone" 
      android:layout_marginTop="25dp"></LinearLayout> 
     <ImageView 
      android:id="@+id/imgv_back" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:background="@drawable/back" 
      android:layout_marginLeft="5dp" 
      android:visibility="gone" 
      android:layout_marginTop="15dp" 
      android:layout_below="@+id/line" 
      /> 

     <TextView 
      android:id="@+id/txtv_myuserloginname" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerVertical="true" 

      android:layout_marginTop="10dp" 
      android:layout_centerHorizontal="true" 
      android:textColor="#222222" 

      android:gravity="center" 
      android:textSize="@dimen/title_size" 
      android:layout_below="@+id/line" 
      /> 
    </RelativeLayout> 
    <View 
     android:id="@+id/view" 
     android:layout_below="@+id/navbar" 
     android:layout_width="match_parent" 
     android:layout_height="2dp" 
     android:background="#ffff01"/> 

<ListView 
     android:id="@+id/ll_Profilelist_liked" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:groupIndicator="@android:color/transparent" 
     android:visibility="visible" 
     android:scrollbars="none" 
     android:layout_below="@+id/view" 
     android:divider="@null" 


     /> 
    </android.support.v4.widget.SwipeRefreshLayout> 

    <ProgressBar 
     android:theme="@style/CircularProgress" 
     style="@style/Widget.AppCompat.ProgressBar" 
     android:layout_centerInParent="true" 
     android:id="@+id/progressbar" 
     android:visibility="gone" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
</RelativeLayout> 

enter image description here

enter image description here

Antwort

0

in erstem Fragmente vor dem zweiten Fragmente gelangt. Ich gehe einfach in die Videoansicht und stoppe Playback zur Videobetrachtung.

   videoview.stopPlayBack(); 
       youtube_view.stopPlayBack(); 
       youtube_view.setVisibility(view.GONE); 
       videoview.setVisibility(view.GONE); 
Verwandte Themen