This article is from http://blog.csdn.net/hellogv/, the citation must be noted!On Android to achieve similar launch drawer effect, we must first think of Slidingdrawer. Slidingdrawer is one of the official Android controls, the main character of this article is not it, but the folk control tool collection ~~~android-mi
The Drawerlayout component is also a component in the V4 package and is directly inherited from the ViewGroup class, so this class is also a container class.
The placement and layout of the drawer menu is controlled by the Android:layout_gravity property, with the optional value left, right, or start, end. By using XML to lay out the words, need to take drawerlayout as the parent container, the group interface layout as its first child node, the
Public void Onitemclick(adapterviewintPositionLongARG3) {//Dynamically insert a fragment into the FramelayoutFragment contentfragment =NewContentfragment (); Bundle bundle =NewBundle (); Bundle.putstring ("Text", Menulists.get (position)); Contentfragment.setarguments (bundle);///fragment need to be handed to Fragmentmanager to replace the corresponding view after it is createdFragmentmanager fm = Getfragmentmanager (); Fm.begintransaction (). replace (R.id.content_frame, contentfrag
The result is as follows: I think you have already seen it in many applications. Next let's take a look at how to achieve the sliding drawer effect using SlidingDrawer.
Android. widget. SlidingDrawer class has been added since Android1.5.
Some attributes of the SlidingDrawer control:
Android: allowSingleTapIndicates whether handle can be enabled or disabled.Andro
This article from http://blog.csdn.net/hellogv/, reference must indicate the source!
To achieve a drawer effect similar to launch on Android, you must first think of slidingdrawer. Slidingdrawer is one of the official Android controls. The main character of this article is not it, but a collection of Folk control tools ~~~ An
: layout_height = "wrap_content"Android: text = "bottom textView"Android: textAppearance = "? Android: attr/textAppearanceLarge"Android: gravity = "center_vertical | center_horizontal"/>
You can slide without writing any code on the main interface,
If you want to write some methods, the following methods are used:
Slid
Speaking of on Android to achieve similar launch drawer effect, we must first think of Slidingdrawer. Slidingdrawer is one of the official Android controls, but the main character of this article is not it, but the folk Control tool collection: Android-misc-widgets. Android-
There is a drawer view control drawerlayout in Android Support.v4. Using this control, you can create a good experience by swiping open or close menus horizontally on the screen.Recently in the project, the design has been useful to this effect, but the left and right sides can draw such a menu effect. Using the discovery, in the XML layout and code, almost add the same code, you can achieve the effect of t
Android -- DrawLayout navigation drawerThe implementation of DrawLayout is detailed in the official documentation. However, during the development process, it is still a bit problematic. The official documentation is a bit old. mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, r. string. open, R. string. close); the original api of this method can set the icon image of the app. Now this parameter is missing.For the ActionBarDrawerToggle
(0 mdragviewmdragviewdragrange);}Another layout in OnLayout. Hide ListView:@Override protected void OnLayout (Boolean changed, int l, int t, int r, int b) { super.onlayout (changed, L, T, R, b); Mdragview.layout (0, GetHeight ()-Mdragview.getheight (), getwidth (), getheight ()); Contentview.layout (0, GetHeight (), getwidth (), getheight () + Dragrange); }Next is the layout of the XML:Very easy. Two view inside the view you defineThe final mainactivity:public cl
1. The gridview is a palace grid view. Its definition is very simple. The main attributes are described below:
Android: horizontalspacing = "5dp", Android: verticalspacing = "5dp": distance between two columns, distance between two rows
Android: stretchmode = "columnwidth": Scaling Mode
Android: padding = "10dp": paddi
:
Some details to be aware of
1. There are a number of areas needing attention that need to be added, the effect currently achieved, drawerlayout is covered by the status bar , the benefit is that drawerlayou has more space to present the content. This is Google's official recommendation of the effect, Google's official app is also gradually replaced by this effect.2. Set StatusBar colorA. Add the android:fitssystemwindows= "true" attribute to the
Android Custom Application drawer Launcher
You can sort the application by application name and installation time, and view the specific project code on my GitHub. The link is shown at the end of the article ,:
Core code:
Package com. zms. launcher; import java. util. arrayList; import java. util. hashMap; import java. util. list; import android. app. activity; i
the handle can be turned on or off via theAndroid:animateonclick: Indicates whether there is an animation when the consumer presses the handle to open/close. Android:content: Hidden contentAndroid:handle:handle (handle)Method Animateclose (): animations are implemented when off. Close (): Instant off GetContent (): Get content Ismoving (): Indicates whether the slidingdrawer is moving. Isopened (): Indicates whether Slidingdrawer is all open Lock (): Mask Touch event. Setondrawercloselis
location of the sub-view as long as you find the coordinates. So here we continue to determine the location of the child view.protected void OnLayout (Boolean changed, int l, int t, int r, int b) { log.i ("Wing", Mischanged + ""); if (mischanged) { layoutbottom (); int count = Getchildcount (); for (int i = 0; i Then we add listening to the main button: to toggle the status of the menu, if the menu is closed, then press the display button, if it is
Slidingdrawer is newly added from SDK 1.5 to implement the drawer Effect of launcher. The slidingdrawer configuration adopts the horizontal or vertical expansion (Android: Orientation) mode. in XML, the Android: handle and Android: content must be specified, the former entrusts the image to be expanded (layout configur
Usually we need to display more information on the user's screen, but the user's screen size is limited. How can we use limited space to display more information? Android provides us with the SlidingDrawer class to help us easily achieve the desired effect. Such as moji recommendations in moji weather, 360 security guards are all reflected.
Next we will learn about the SlidingDrawer class to achieve the above effect:
:
When not expanded:
After expans
Android development: Using ViewDragHelper to achieve drawer stretch
In fact, there are many ways to achieve a Layout drawer stretch effect. The most common method is to customize a ViewGroup, then control click events, control movement, and so on, this method has a large amount of code and is complicated to implement. It is also troublesome to add other effects t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.