!!!!! The Android interface always shows the problem of loading the progress bar, so don't mess with listfragment

Source: Internet
Author: User

The latest Android app is almost finished, but the individual interface has flaws, and how to modify it can not solve the lingering shadow. The problem is as follows:

In the interface, the data has been loaded, but there is a circular progress bar, feel it is always loading something, seriously affect the interface beautiful:

1. The layout is LinearLayout

2. The interface layout is Relativelayout

Various methods have tried, of course, are based on the layout of the file changes, what fill_parent, Alignbotton, for different layouts, various properties have tried it all over again, do not, in order to the layout of the problem of a full three days.

Anyway, the layout of the file on the how to toss may not be over.

Calm down and think, will the problem go somewhere else, not the layout file?

Recall just learned Android that few days, according to the example of the book, which mentioned the ListView part, also referred to the circular progress bar, so opened the book, find that chapter, suddenly steady!

Note the underlined text in the photo: "When the ListView has no content to display ... Show a circular progress bar "Okay, is the problem out of the app's ListView?"

So let's see what the ListView in this interface is about:

<?xml version= "1.0" encoding= "Utf-8"?> <scrollview xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Fill_parent "android:layout_height=" fill_parent "><linearlayout android:id=" @+id/fragmentcontainer "android:layout_width=" fill_parent "android:layout_height=" Wrap_content "Android:orienta         tion= "vertical" > <LinearLayout> <--Header, ignore--</LinearLayout> <listview Android:id= "@+id/list_uploadinfo_1" android:layout_width= "fill_parent" android:layout_height= "fill_parent "Android:dividerheight=" 1px "android:divider=" #B8B8B8 "> </ListView> <button Android : text= "Upload quantity map of each site"/> <LinearLayout> <--header, ignore-</LinearLayout> <listview an        Droid:id= "@+id/list_uploadinfo_2" android:layout_width= "fill_parent" android:layout_height= "Fill_parent"   android:dividerheight= "1px"           Android:divider= "#B8B8B8" > </ListView> <button android:text= "Monthly upload trend chart"/> </l Inearlayout></scrollview>

Structurally, there are two ListView, but they are all filled with data and there is no problem with no content.

Is there any other listview? The answer is really that there are other ListView, and, is the biggest listview, but I ignored:

public class Uploadinfofragment extends Listfragment {//note, is inherited listfragmentprivate Hashmap<string, integer> Monthquantitymap;private hashmap<string, integer> stationquantitymap, ...}

is to control the interface of the fragment, it inherits the Listfragment, it will need their own ListView to display the content, but only just two internal ListView filled the content, the outside of this big no, so there will be this lingering round progress bar!!!

So what? It's simple, since you don't need to populate this largest listview with data, why use Listfragment? It is possible to use ordinary fragment.

In fact, the reason used here is listfragment, completely because in this function, most of the code is moved from other functions, so the listfragment also moved over.

Then make the modification to allow this class to inherit the normal Fragment:

public class Uploadinfofragment extends Fragment {//note, use normal Fragment to private hashmap<string, integer> Monthquantitymap;private hashmap<string, integer> stationquantitymap, ...}
Finally put the nasty round progress bar away, problem solving!

Summary : Some of the common problems, on-line search on it, but these hidden deep problems, it is generally difficult to find out directly on the Internet, this time if you can carefully take over a book, perhaps there will be a surprise discovery ~

In addition, usually in reading the time is still serious for good, so that some details can be printed in the brain, maybe when it comes in handy ~

!!!!! The Android interface always shows the problem of loading the progress bar, so don't mess with listfragment

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.