Thursday, September 19, 2013

[android help] How we can change relative layout to ListView Android


How we can change relative layout to ListView Android


How we can change relative layout to ListView Android - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
















I want to convert relative layouts in a ListView .So that i can repeat the data as much as many times i get data from the server .The layout id that i want to be in a listview are depart_flight_details_duration,passenger_details_layout.How i can covert this two layouts in a ListView.Please help me on this i am new in android.


XML



android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

android:id="@+id/imgLogo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="5dip"
android:padding="3dip"
android:src="@drawable/logo_demo" />

android:id="@+id/main_scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imgLogo" >

android:id="@+id/main_ScrollView_Container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

android:id="@+id/trip_details_main"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:background="@drawable/flight_detail"
android:gravity="center_vertical" >

android:id="@+id/trip_locations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:text="Delhi to Hydrabad"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:textStyle="bold" />

android:id="@+id/depart_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/trip_locations"
android:layout_marginLeft="5dp"
android:text="18 Sep 2013"
android:textColor="#FFFFFF"
android:textSize="15sp" />

android:id="@+id/imgRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="12dp"
android:src="@drawable/cal" />


android:id="@+id/travel_itin_header"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_below="@+id/trip_details_main"
android:layout_marginTop="2dp"
android:background="@drawable/gray"
android:gravity="center_vertical" >

android:id="@+id/itinerary_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="90dp"
android:layout_marginTop="5dp"
android:text="Itinerary Details"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold" />


android:id="@+id/passenger_details_layout"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_below="@+id/travel_itin_header"
android:layout_marginTop="2dp"
android:background="@drawable/gray"
android:gravity="center_vertical" >

android:id="@+id/pax_image"
android:layout_width="wrap_content"
android:layout_height="50dip"
android:layout_alignParentLeft="true"
android:padding="3dip"
android:src="@drawable/black_man" />

android:id="@+id/first_pax_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/pax_image"
android:layout_marginLeft="12dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/pax_image"
android:text=" XXX XXX XXX"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold" />

android:id="@+id/imgRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/first_pax_name"
android:layout_alignParentRight="true"
android:src="@drawable/arrow2" />


android:id="@+id/depart_flight_details_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/passenger_details_layout"
android:layout_marginTop="2dp"
android:background="@drawable/small_search" >

android:id="@+id/flight_depart_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="3dip"
android:src="@drawable/dep" />

android:id="@+id/depart_return_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/flight_depart_image"
android:layout_marginLeft="12dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@+id/arrow_image"
android:layout_toRightOf="@+id/flight_depart_image"
android:text="Delhi to Hydrabad"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold" />

android:id="@+id/one_way_date_and_duration_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/depart_return_location"
android:layout_marginLeft="12dp"
android:layout_toRightOf="@+id/flight_depart_image"
android:text="18 Sep 2013 09:45 | Duration 2:45"
android:textColor="#FFFFFF"
android:textSize="12sp" />

android:id="@+id/arrow_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/depart_return_location"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:src="@drawable/arrow2" />


android:id="@+id/travel_agency_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/depart_flight_details_duration"
android:layout_marginTop="2dp"
android:background="@drawable/travelagency_bg" >

android:id="@+id/travel_agency_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:text="Travel Agency"
android:textColor="#676767"
android:textSize="15sp"
android:textStyle="bold" />


android:id="@+id/tarvel_agency_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/travel_agency_header"
android:layout_marginTop="2dp" >

android:id="@+id/agent_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@drawable/logo" />

android:id="@+id/mobile_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/agent_logo"
android:src="@drawable/mobile" />

android:id="@+id/at_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/mobile_logo"
android:src="@drawable/at" />

android:id="@+id/email_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/at_logo"
android:src="@drawable/at" />

android:id="@+id/travel_agency_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/agent_logo"
android:layout_marginLeft="5dp"
android:text="Address : XXXXXXXX"
android:textColor="#676767" />

android:id="@+id/travel_agency_fax"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/travel_agency_address"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:text="Fax : XXXXXXXX"
android:textColor="#676767" />


android:id="@+id/genral_remarks_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tarvel_agency_details"
android:layout_marginTop="2dp"
android:background="@drawable/general_remar" >

android:id="@+id/genral_remark_header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:text="Genral Remarks"
android:textColor="#676767"
android:textSize="15sp"
android:textStyle="bold" />


android:id="@+id/genral_remark_text_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/genral_remarks_header"
android:layout_marginTop="2dp" >

android:id="@+id/genral_remark_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:text="HAVE A NICE TRIP"
android:textColor="#676767" />






























You have to use custom listview.


And for two listview in one layout see this link Link




















default






Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...