[android-developers] How to make Sliding Drawer push a existing layout when showing?
Hi, I have a relative layout and a sliding drawer in a frame layout, it works fine, I can pull out the drawer and it shows on the top of the relative layout. However, now I want to make the sliding drawer push the relative layout when showing. I've searched on google and the android dev ref, only got a not well answered thread : http://stackoverflow.com/questions/8209740/how-to-make-slidingdrawer-push-existing-layouts-when-showing Below is my Layout xml file, could you give me any hint? Android API Level: 13 Honeycomb -- ?xml version=1.0 encoding=utf-8? FrameLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/frameLayout_landscape android:layout_width=wrap_content android:layout_height=match_parent RelativeLayout android:id=@+id/screen_landscape android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical RelativeLayout android:id=@+id/layout_landscape android:layout_width=match_parent android:layout_height=match_parent android:layout_alignParentLeft=true android:layout_alignParentTop=true android:orientation=vertical ImageView android:id=@+id/imageView_screen_landscape android:layout_width=match_parent android:layout_height=match_parent android:layout_alignParentTop=true / Button android:id=@+id/button_left_landscape android:layout_width=420px android:layout_height=52px android:layout_alignParentBottom=true android:layout_alignParentLeft=true android:layout_marginBottom=15px android:layout_marginLeft=50px android:background=@android:color/transparent / Button android:id=@+id/button_right_landscape android:layout_width=400px android:layout_height=52px android:layout_alignParentBottom=true android:layout_alignParentRight=true android:layout_marginBottom=15px android:layout_marginRight=110px android:background=@android:color/transparent / Button android:id=@+id/button_up_landscape android:layout_width=60px android:layout_height=60px android:layout_alignParentRight=true android:layout_marginRight=30px android:layout_marginTop=150px android:background=@android:color/transparent / Button android:id=@+id/button_down_landscape android:layout_width=60px android:layout_height=60px android:layout_alignParentRight=true android:layout_marginRight=30px android:layout_marginTop=475px android:background=@android:color/transparent / /RelativeLayout /RelativeLayout SlidingDrawer android:id=@+id/slidingDrawer_landscape android:layout_width=wrap_content android:layout_height=wrap_content android:content=@+id/content_landscape android:handle=@+id/handle_landscape android:orientation=horizontal android:topOffset=800px Button android:id=@+id/handle_landscape android:layout_width=100px android:layout_height=270px android:background=@android:color/transparent android:text=/ LinearLayout android:id=@+id/content_landscape android:layout_width=match_parent android:layout_height=match_parent android:orientation=horizontal TableLayout android:id=@+id/tableLayout_landscape android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=vertical android:layout_marginTop=200px TableRow android:id=@+id/tableRow1_landscape android:layout_width=wrap_content android:layout_height=wrap_content Button android:id=@+id/button_numpad_1_landscape android:layout_width=70px android:layout_height=70px android:layout_column=6 android:text=1 android:textColor=@color/red android:textSize=35px android:textStyle=bold / Button android:id=@+id/button_numpad_2_landscape android:layout_width=70px android:layout_height=70px
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
On Wed, Dec 14, 2011 at 5:47 PM, Vincent renws1...@gmail.com wrote: I have a relative layout and a sliding drawer in a frame layout, it works fine, I can pull out the drawer and it shows on the top of the relative layout. However, now I want to make the sliding drawer push the relative layout when showing. AFAIK, there's no way do to that with SlidingDrawer as it stands. You could copy the source for it and modify it to suit, using animations, but this might not be a trivial change. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
Thanks for your reply. Is there any other way to do such things? -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
On Wed, Dec 14, 2011 at 6:04 PM, Vincent renws1...@gmail.com wrote: Thanks for your reply. Is there any other way to do such things? What are such things? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
Apologise for ambiguous question. You said there's no way do to that with SlidingDrawer, I am wondering if I can get the animation with other widget/layout/view. What I want are: when I slide a numpad from the right side, the current match_parent layout becomes smaller. when I push the numpad back, the layout becomes match_parent again. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
I cannot think of anything off the top of my head that would give that behavior out of the box. On Wed, Dec 14, 2011 at 6:52 PM, Vincent renws1...@gmail.com wrote: Apologise for ambiguous question. You said there's no way do to that with SlidingDrawer, I am wondering if I can get the animation with other widget/layout/view. What I want are: when I slide a numpad from the right side, the current match_parent layout becomes smaller. when I push the numpad back, the layout becomes match_parent again. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
I figured out how to use OnDrawerOpenListener and OnDrawerCloseListener to implement the animation. SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.slidingDrawer1); drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() { public void onDrawerOpened() { ImageView image = (ImageView) findViewById(R.id.imageView1); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(500, 500); image.setLayoutParams(layoutParams); } }); drawer.setOnDrawerCloseListener(new OnDrawerCloseListener() { public void onDrawerClosed() { ImageView image = (ImageView) findViewById(R.id.imageView1); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(700, 700); image.setLayoutParams(layoutParams); } }); However, I want the image changes its size in a gradient way, and its size depends on the position of the drawer's handler button. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to make Sliding Drawer push a existing layout when showing?
Another thing is how to change a button's attributes at run time. say, for example, I have four buttons in a relative layout (as the code showed in my first post). After the slidingdrawer opened, I am able to change the relative layout in this way: SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.slidingDrawer_landscape); drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() { public void onDrawerOpened() { RelativeLayout layout = (RelativeLayout) findViewById(R.id.screen_landscape); layout.setLayoutParams(new FrameLayout.LayoutParams (900, LayoutParams.MATCH_PARENT)); } } But how can I change the attributes of the buttons (width, height and margins)? -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en