0

I am Using VideoView in my code for playing some video from an URL. My VideoView is inside a Linear Layout which inside a ScrollView.
I have Problem with MediaController Object Which appear in bottom of Video view over other View which located inside scrollView and constant location in screen (I mean when Scrolled down screen all view move except this)
I want Set this MediaController in constant Location below videoView which move with scroller.
My XML Code is Here:

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="94dp"
        android:layout_marginTop="196dp" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <AbsoluteLayout
                android:id="@+id/nonVideoLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >



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

                    <com.HRDatis.component.VideoViewQmery
                        android:id="@+id/playerImage"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
                </LinearLayout>

And JAVA code here :

    ((LinearLayout)(findViewById(R.id.playerLayout))).setLayoutParams(new LayoutParams((int)(width) , (int)(height*0.371) ,0 , (int)(height*(0.0)) ));
    VideoViewQmery videoView =((VideoViewQmery)(findViewById(R.id.playerImage)));
    MediaController mediaController = new MediaController(this); 
    mediaController.setAnchorView(videoView);
    videoView.setVideoURI(Uri.parse(URI));
    videoView.setMediaController(mediaController);

Note that,All of Dimension set in java in activity in onCreate function.Also,I used setLayoutparam function for mediaController but it didn't work and mediaController didnt move. Only SetY and SetX works.This function move MediaController related to VideoView and didn't solve my problem(I mean MediaController didnt move with Scroll). Thanks in advance.

Majid
  • 39
  • 1
  • 11

1 Answers1

0

This may be a solution for you MediaController Positioning - bind to VideoView

As mentioned in the solution the controller doesn't show and hide with tapping the videoview, but you mention wanting it static anyway

Community
  • 1
  • 1