CSharp programmers Learn Android development---3.Android internal elements are not populated with bugs

Source: Internet
Author: User

Recently, the company organized project team members to develop an Android project demo, no one has andoid development experience, are developing C #. Although the project requirements are not very high, but for those who do not have this experience, the first step is the most difficult.

The project lasted one months, 4 people developed, the final line into a usable demo, the overall effect is very good. This one borrowed from the online "Imitation NetEase client Demo" There is also learning "Crazy Android", a lot of harvest, here use a few articles to do a project experience summary, there is more from C #

Programmer's point of view to understand some of the similarities and differences of Android.

Article directory:

CSharp programmers Learn Android Development---1. Andriodide, master tools use CSharp Programmer to learn Android development---2. The shortcut keys for personal Summary csharp programmer learn Android Development---3.Android internal elements do not populate bugs

Case: Layout Error:

First of all, this problem is one of the difficulties encountered in the development of the project, Baidu's solution is not much, the final bubble on the StackOverflow found the answer.

The red part of the figure is the part that the picture is supposed to fill, but it is not filled with the background red, and the two blue lines on the right are the same. Believe that many people have encountered this problem, so do not want to say that the element attribute is already fill_parent or match_parent, in some cases, the fill_parent will be invalid.

Finally, the joy is in a few hours of trying, search after finally found the problem, this is layout of a bug, has been submitted to the official Android, probably the problem is, in some cases, the control does not refresh itself to the size of the result.

Here are the steps to resolve:
1. Replace the fill_parent with the Match_parent
2. Set parameters android:adjustviewbounds= "true" and Android:scaletype= "Fitxy" in ImageView, all ImageView are recommended.
or Img.setscaletype (SCALETYPE.FIT_XY); Img.setadjustviewbounds (TRUE);

Eventually, all the pictures are really "filled", and the principle is to force the picture to refresh itself, which could lead to some efficiency problems.

Reference

BUG: Workaround for layout error when one of the controls in the layout is gone: http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
Elements in Bug:linearlayout are not fillbug:http://stackoverflow.com/questions/5403970/ Imageview-adjustviewbounds-does-not-work-with-layout-height-fill-parent
Http://stackoverflow.com/questions/16462407/android-imageview-from-url-wont-fill-parent-in-listview

CSharp programmers Learn Android development---3.Android internal elements are not populated with bugs

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.