Thursday, July 29, 2010

Re: [android-developers] Re: VideoView and SlidingDrawer problem

Thanks a lot, but unfortunately that didn't do the trick. Somehow VideoView wants to stay at front, I tried to set it to SendToBack() but that was undefined for VideoView. 

On Thu, Jul 29, 2010 at 9:30 AM, Sarwar Erfan <erfanonline@gmail.com> wrote:
Hi,
Seems like z order issue.

Try this:

1. Add these imports to the Activity:
import android.widget.SlidingDrawer;
import android.widget.SlidingDrawer.OnDrawerCloseListener;

2. Add a class member variable in the Activity for the SlidingDrawer
private SlidingDrawer mSlidingDrawer;

3. In OnCreate of the Activity, initialize the member variable. Also,
set the OnDrawerCloseListener

       @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
      //.................
      //your other codes

       this.mSlidingDrawer =
(SlidingDrawer)findViewById(R.id.drawer);
       this.mSlidingDrawer.setOnDrawerCloseListener(this);
       }

4. Implement OnDrawerCloseListener in the Activity. In the
onDrawerClose method, change the z order (bring the drawer to the
front)
public class MyActivity extends Activity implements
OnDrawerCloseListener {

 //other codes.....................


       @Override
       public void onDrawerClosed() {
               this.mSlidingDrawer.bringToFront();
       }



}



Hope this helps. Please let me know the result.


Regards
Sarwar Erfan



On Jul 29, 7:17 am, kivy <victoriasarabu...@gmail.com> wrote:
> Hi there,
>
> I have a bit of a problem with a SlidingDrawer that I created and that
> should go over my VideoView. When the activity is opened for the first
> time you can see the slider above the video and when you tap it, it
> slides open. However, as soon as you close the slider it seems to
> disappear underneath the VideoView and is not visible anymore. It is
> still there and when you tap the location where the handle is located
> the slidingDrawer reappears, but I would rather prefer if it wasn't
> hiding all the time ;)
>
> If anyone knows what I can do about that and help me out, that would
> be really fantastic because I have been trying for hours now and I
> have no idea what I should do. I also haven't found a similar issue or
> a solution for that.
>
> Thank you in advance.
>
> This here is the xml code for the videoview and the slidingDrawer:
>
> <?xml version="1.0" encoding="utf-8"?>
>
>         <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                         android:layout_width="fill_parent"
>                         android:layout_height="fill_parent"
>                         android:background="@drawable/shape_background_gradient"
>                               >
>
>                 <VideoView
>                         android:layout_width="240px"
>                         android:layout_height="180px"
>                         android:id ="@+id/VideoViewEdit"
>                         android:layout_centerHorizontal="true"
>                         >
>                 </VideoView>
>                 <ScrollView
>                                 android:layout_width="fill_parent"
>                                 android:layout_height="wrap_content"
>                                 android:layout_below="@id/VideoViewEdit">
>                         <TableLayout
>                                         android:layout_width="fill_parent"
>                                         android:layout_height="fill_parent"
>                                         android:stretchColumns="0">
>                                 <TableRow
>                                                 android:background="@drawable/shape_track_background"
>                                                 android:padding="5px"
>                                                 >
>                                         <ImageView android:layout_width="wrap_content"
>                                                            android:layout_height="wrap_content"
>                                                            android:src="@drawable/ic_editor_videotrack"
>                                                            android:padding="5px"
>                                                            android:layout_gravity="left"/>
>
>                                 </TableRow>
>                                 <TableRow
>                                                 android:background="@drawable/shape_track_background"
>                                                 android:padding="5px"
>                                                 >
>                                                 <ImageView android:layout_width="wrap_content"
>                                                            android:layout_height="wrap_content"
>                                                            android:src="@drawable/ic_editor_audiotrack"
>                                                            android:padding="5px"
>                                                            android:layout_gravity="left"/>
>
>                                 </TableRow>
>                                 <TableRow
>                                                 android:background="@drawable/shape_track_background"
>                                                 android:padding="5px"
>                                                 >
>                                         <ImageButton android:layout_width="wrap_content"
>                                                            android:layout_height="wrap_content"
>                                                            android:src="@drawable/ic_editor_add_media"
>                                                            android:padding="5px"
>                                                            android:layout_gravity="left"
>                                                            />
>                                 </TableRow>
>                         </TableLayout>
>                 </ScrollView>
>  <SlidingDrawer
>      android:id="@+id/drawer"
>      android:layout_width="wrap_content"
>      android:layout_height="wrap_content"
>          android:orientation="horizontal"
>      android:handle="@+id/handle"
>      android:content="@+id/content">
>
>      <ImageView
>          android:id="@id/handle"
>          android:layout_width="wrap_content"
>          android:layout_height="wrap_content"
>          android:src="@drawable/slider_handle"
>          />
>
>      <LinearLayout
>          android:id="@id/content"
>          android:layout_width="fill_parent"
>          android:layout_height="fill_parent"
>          android:orientation="vertical">
>         <ImageButton
>                 android:id="@+id/button_exposure"
>                 android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:background="#77000000"
>                         android:src="@drawable/ic_slider_exposure"
>                         android:padding="5px"
>                         android:layout_marginBottom="1px"
>                         android:layout_gravity="left"/>
>         <ImageButton
>                 android:id="@+id/button_properties"
>                 android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:background="#77000000"
>                         android:src="@drawable/ic_slider_properties"
>                         android:padding="5px"
>                         android:layout_marginBottom="1px"
>                         android:layout_gravity="left"/>
>         <ImageButton
>                 android:id="@+id/button_special_effects"
>                 android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:background="#77000000"
>                         android:src="@drawable/ic_slider_special_effects"
>                         android:padding="5px"
>                         android:layout_marginBottom="1px"
>                         android:layout_gravity="left"/>
>                 <ImageButton
>                 android:id="@+id/button_test1"
>                 android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:background="#77000000"
>                         android:src="@drawable/ic_slider_exposure"
>                         android:padding="5px"
>                         android:layout_marginBottom="1px"
>                         android:layout_gravity="left"/>
>         <ImageButton
>                 android:id="@+id/button_test2"
>                 android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:background="#77000000"
>                         android:src="@drawable/ic_slider_exposure"
>                         android:padding="5px"
>                         android:layout_marginBottom="1px"
>                         android:layout_gravity="left"/>
>      </LinearLayout>
>      <ViewStub
>         android:id="@+id/stub"
>         android:layout_width="fill_parent"
>         android:layout_height="fill_parent"
>         android:background="#77000000">
>      </ViewStub>
>  </SlidingDrawer>
> </RelativeLayout>

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment