Family Tree

razkoko1razkoko1 ILMember
edited November 2017 in Xamarin.Android

Hello guys, i am new in xamarin programming and i want to build family tree.

I did some search for ideas but i couldn't get some useful material.

If you have some idea what is the easiest way to build this kind of view, i will be more than happy to know about.
thanks !

Tagged:

Posts

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai
    edited December 2017

    Have any specific mockups or sketches of what you want this to look like?

    Your best bet would be creating a nested series of ViewGroup controls that include the custom View that are created based on a family tree data structure dynamically.

    You can also look at existing apps on the Google Play Store and use the Hierarchy Viewer tool to get a general idea of the controls used for their layout.

    https://developer.android.com/studio/profile/hierarchy-viewer.html

    Given the example: Grandparents ->Parents -> Children

    For example I would start with a LinearLayout that is oriented vertical. This will be the master ViewGroup that will place other ViewGroup controls in a stack. I would then create another LinearLayout that is oriented horizontally This would include the grandparents objects. In this case, a grandma and grandpa custom views displayed from a repeater control like RecyclerView or ListView.

    Based on my business logic I would then check if either of them have kids. If they do, I would create another LinearLayout that is nested inside the first one that would include the parents custom views.

    Finally I would do the same for the children.

    In all, your XML might look like this:

        <LinearLayout android:orientation="vertical"> //Houses all ViewGroups 
            <LinearLayout id=grandparents android:orientation="horizontal" >
                <RecyclerView or ListView of grandparents>
                    <LinearLayout id=parents android:orientation="horizontal">
                        <RecyclerView or ListView of parents>
                            <LinearLayout id=children android:orientation="horizontal">
                                <RecyclerView or ListView of children>
    
  • razkoko1razkoko1 ILMember

    thanks a lot, good ideas. i will try it, and will update soon.

  • razkoko2razkoko2 Member
    edited January 2018

    works well
    it dosent aloow me to put the code here...

    thanks a lot

Sign In or Register to comment.