android - How do you create a layout that is as shown in the image? -
i off creating travel app had such design in pic above. central dot denotes intermediate stops between 2 locations. first source, second destination.
i know best way acheive layout described in image travel app.
thanks in advance.
code tried below here: (sample)
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:id="@+id/textview1" android:layout_width="224dp" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_marginleft="30dp" android:layout_margintop="16dp" android:text="textview" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/textview1" android:layout_alignparentright="true" android:layout_below="@+id/textview1" android:layout_margintop="44dp" android:text="textview" /> <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textview2" android:layout_alignparentleft="true" android:layout_aligntop="@+id/textview1" android:src="@drawable/abc_ic_go_search_api_holo_light" /> <imageview android:id="@+id/imageview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/textview2" android:layout_alignparentleft="true" android:layout_aligntop="@+id/textview2" android:src="@drawable/abc_ic_go_search_api_holo_light" /> <view android:id="@+id/line" android:layout_width="2dp" android:layout_height="wrap_content" android:layout_alignbottom="@+id/imageview2" android:layout_alignleft="@+id/imageview1" android:layout_below="@+id/imageview1" android:layout_marginbottom="10dp" android:layout_marginleft="10dp" android:layout_margintop="-10dp" android:background="#ff00ff00" /> </relativelayout>
i can source, intermediate, times in layout, not sure how add dynamic intermediate 'dots' in layout. please note there can multiple intermediate stops.
since said these locations dynamically populated , count might possibly high, can try listview, divider height 0 , items following:
source: 1st item
other intermediate locations
destination: last item
listview have these:
android:dividerheight="0dp" android:divider="@null"
Comments
Post a Comment