Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contentViews is not Incomplete #5

Open
xingag opened this issue Nov 3, 2015 · 1 comment
Open

contentViews is not Incomplete #5

xingag opened this issue Nov 3, 2015 · 1 comment

Comments

@xingag
Copy link

xingag commented Nov 3, 2015

If I want to show empty or error layout ,and want to show a part of widget ,And The layout is a child in other widget . and it take no effect. i think the contentViews is incomplete, it must be include the all child view

@xingag
Copy link
Author

xingag commented Nov 3, 2015

<com.vlonjatg.progressactivity.ProgressActivity
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:progressActivity="http://schemas.android.com/apk/res-auto"
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
progressActivity:loadingBackgroundColor="#FFFFFF"
progressActivity:emptyBackgroundColor="#fbc02d"
progressActivity:emptyContentTextColor="#FFFFFF"
progressActivity:emptyTitleTextColor="#FFFFFF"
progressActivity:errorBackgroundColor="#42a5f5"
progressActivity:errorButtonTextColor="#FFFFFF"
progressActivity:errorContentTextColor="#FFFFFF"
progressActivity:errorTitleTextColor="#FFFFFF">

<android.support.v7.widget.Toolbar
    android:id="@+id/activityToolbar"
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:elevation="2dp"
    android:theme="@style/Toolbar" />

<LinearLayout
    android:id="@+id/container"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


<TextView
    android:id="@+id/one"
    android:gravity="center"
    android:layout_width="fill_parent"
    android:layout_height="100dip"
    android:layout_marginTop="56dp"
    android:text="1111" />
    <TextView
        android:id="@+id/two"
        android:gravity="center"
        android:layout_width="fill_parent"
        android:layout_height="100dip"
        android:layout_marginTop="56dp"
        android:text="2222" />



</LinearLayout>

</com.vlonjatg.progressactivity.ProgressActivity>

then :

@OverRide
public void addView(@nonnull View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);

    if (child.getTag() == null || (!child.getTag().equals(TAG_LOADING) &&
            !child.getTag().equals(TAG_EMPTY) && !child.getTag().equals(TAG_ERROR)))
    {
        if (child instanceof LinearLayout)
        {
            LinearLayout ll = (LinearLayout) child;
            for(int i=0;i<ll.getChildCount();i++)
            {
                contentViews.add(ll.getChildAt(i));
            }
        } else
        {
            contentViews.add(child);
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant