Android Open Source Control Viewflow Learning notes "with download Address"--(Original-20150407)

Source: Internet
Author: User

Android Open Source Control Viewflow Learning

Here's a quick introduction: Throw IllegalStateException:

"Viewflow can only is used in exactly mode."

First of all to clarify the advantages of Viewflow: (1). Viewflow is more suitable for dynamic size, the number of slices from the background, how much to show how much, this is not very suitable for viewpager.

(2) The rotation of the viewflow is very smooth, the transition is very friendly, and the loop is supported.

When using Viewflow, it is only possible to use the "Viewflow can only is used in exactly mode" for the size-determined pattern.

At this point, if your own layout is indeterminate size, there may be an error, there is a not good workaround is to set a wide padding parent control, set a fixed value height.

If there is a problem: You can make the following modifications in the Onmeasure () method: (for reference only)

Modify the following code:

if (heightmode! = measurespec.exactly &&!isineditmode ()) {throw new IllegalStateException ("Viewflow can only is U Sed in exactly mode. ");

Shield off the first sentence: Super.onmeasure (Widthmeasurespec, Heightmeasurespec);
The modified if is judged as follows:
Heightmeasurespec = Measurespec.makemeasurespec (commonutil.dip2px (Mcontext), measurespec.exactly); Super.onmeasure (Widthmeasurespec, Heightmeasurespec);

The mode setting for height is set to: Exactly, the size is set by itself. The Makemeasurespec parameter, the first bit is the size.

Other places can be modified on the basis of reading code.

Here is Viewflow source code: Viewflow Source


Android Open Source Control Viewflow Learning Notes "included"--(Original-20150407)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.