Android VideoView with ImageView
<p>I want to click on an image and set the visibility of VideoView and make the imageView invisible.However when I click on image a white nbackground appears.Please help.
</p>

<pre><code>feedImageView.setOnClickListener(new OnClickListener() {
    String substr2 =item.getImge().substring(item.getImge().length() - 3);
    @Override
    public void onClick(View v) {
        if(item.getImge()!=null)
        {
            if(substr2.equals("jpg"))
            {
                Log.e(TAG,"Its image");
            }
            else if(substr2.equals("mp4"))
            {
                feedImageView.setVisibility(View.INVISIBLE);
                MediaController mc=new MediaController(getActivity());
                mc.setAnchorView(vid);
                mc.setMediaPlayer(vid);
                Log.e(TAG,"In mp4 "+item.getImge());
                Uri uri = Uri.parse(item.getImge());
                vid.setMediaController(mc);
                vid.setVideoURI(uri);
                vid.setVisibility(View.VISIBLE);
                vid.start();

                Log.e(TAG, "Its video");
            }
        }
    }
});
</code></pre>

<p>Layout of the imageView and videoView
</p>

<pre><code>&lt;com.example.adapter.FeedImageView
    android:id="@+id/feedImage1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:layout_marginTop="10dp"
    android:scaleType="fitXY"
    android:visibility="visible" /&gt;
&lt;VideoView
    android:id="@+id/vid"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:scaleType="fitXY"
    android:visibility="invisible" /&gt;
</code></pre>

<p>Complete layout file -
</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/feed_bg"
    android:orientation="vertical" &gt;

    &lt;LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="@dimen/feed_item_margin"
        android:layout_marginRight="@dimen/feed_item_margin"
        android:layout_marginTop="@dimen/feed_item_margin"
        android:background="@drawable/bg_parent_rounded_corner"
        android:orientation="vertical"
        android:paddingBottom="@dimen/feed_item_padding_top_bottom"
        android:paddingTop="@dimen/feed_item_padding_top_bottom" &gt;

        &lt;LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingLeft="@dimen/feed_item_padding_left_right"
            android:paddingRight="@dimen/feed_item_padding_left_right" &gt;

            &lt;com.android.volley.toolbox.NetworkImageView
                android:id="@+id/profilePic"
                android:layout_width="@dimen/feed_item_profile_pic"
                android:layout_height="@dimen/feed_item_profile_pic"
                android:scaleType="fitCenter" &gt;
            &lt;/com.android.volley.toolbox.NetworkImageView&gt;

            &lt;LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="center"
                android:gravity="center"
                android:paddingLeft="@dimen/feed_item_profile_info_padd" &gt;
                &lt;TextView
                    android:id="@+id/name"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:textSize="@dimen/feed_item_profile_name"
                    android:textColor="#0f84cc"
                    android:textStyle="bold" /&gt;
            &lt;/LinearLayout&gt;
        &lt;/LinearLayout&gt;

       &lt;!--  &lt;VideoView
            android:id="@+id/feedImage1"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginTop="15dp"
           android:background="#000000"
             /&gt; --&gt;

            &lt;com.example.adapter.FeedImageView
            android:id="@+id/feedImage1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:layout_marginTop="10dp"
            android:scaleType="fitXY"
            android:visibility="visible" /&gt;
        &lt;VideoView
            android:id="@+id/vid"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
             /&gt;

         &lt;TextView
            android:id="@+id/txtStatusMsg"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"

            android:paddingLeft="@dimen/feed_item_status_pad_left_right"
            android:paddingRight="@dimen/feed_item_status_pad_left_right"
            android:paddingTop="@dimen/feed_item_status_pad_top" /&gt;

        &lt;Button 
            android:id="@+id/downloadbtn" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Download"
            android:textColor="#ffffff"
            android:gravity="center"
            android:padding="10dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="10dp"
            android:background="#0f84cc"
            /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>