2

I have an xml layout file as shown below

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/homeCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivitys.ViewPager.Fragments.Home">
    <com.yalantis.phoenix.PullToRefreshView
        android:id="@+id/pull_to_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.v7.widget.RecyclerView
            android:id="@+id/fragment_dashboard_recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </android.support.v7.widget.RecyclerView>
    </com.yalantis.phoenix.PullToRefreshView>
</android.support.design.widget.CoordinatorLayout>

I want to add a view to the container of the pulltorefresh programmatically, I have added it to my coordinator as shown below but I do not know how to add it to my pulltorefresh any ideas?

 CoordinatorLayout coordinatorLayout=(CoordinatorLayout)view.findViewById(R.id.homeCoordinatorLayout);
        ImageView imageView=new ImageView(getActivity());
        imageView.setImageResource(R.drawable.ufo);
Cœur
  • 37,241
  • 25
  • 195
  • 267
Eli
  • 827
  • 1
  • 7
  • 21

1 Answers1

0
coordinatorLayout.addView(imageView);

Edit*
If you would like to know more on the subject you can find it here:
1. ViewManager Official Documentation.
2. Straight forward Tutorial about how to add all kinds of views by Mysamplecode.
3. Related SO answer on the subject to prevent common misunderstandings.

Community
  • 1
  • 1
Nir Duan
  • 6,164
  • 4
  • 24
  • 38
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/13490799) – Suhail Mehta Aug 29 '16 at 04:57
  • @SuhailMehta , Agree! Sometimes I'm being to simple. – Nir Duan Aug 29 '16 at 06:41