onClick event of fragmentActivity's view inside of Fragment class? - android

I have included a common layout inside of FragmentActivity.I want to fire onclick event of common layout ToggleButton, inside of fragment class.How can I achieve this?
ToggleButton tbMainLocation = (ToggleButton) getView().findViewById(
R.id.tbMainLocation);
but tbMainLocation always return nullpointerexception
commonlayout:
layout_include.xml
<?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="wrap_content" >
<RelativeLayout
android:id="#+id/rlMainLivTopBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/cyan"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="#+id/txtMainBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="<"
android:textColor="#color/white"
android:textSize="30sp"
android:visibility="gone" />
<ImageView
android:id="#+id/imgMainBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/back"
android:visibility="gone" />
<AutoCompleteTextView
android:id="#+id/actv_edt_search_tag_feed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="5dp"
android:background="#drawable/round_corner_edittext"
android:ems="10"
android:hint="Search by tag"
android:singleLine="true"
android:text=""
android:textSize="15dp"
android:visibility="gone" >
<requestFocus />
</AutoCompleteTextView>
<TextView
android:id="#+id/txtMainTagneme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text=""
android:textColor="#color/white"
android:visibility="gone" />
<TextView
android:id="#+id/txtMainExpertName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text=""
android:textColor="#color/white"
android:visibility="gone" />
<!--
<ImageView
android:id="#+id/img_notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
androImid:background="#drawable/notification" />
-->
<ImageView
android:id="#+id/imgMainExpertEarnByFlight"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="#drawable/plane_normal"
android:visibility="gone" />
<!--
<ImageView
android:id="#+id/imgMainLocation"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="5dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/imgMainSearch"
android:background="#drawable/location"
android:visibility="visible" />
-->
<ToggleButton
android:id="#+id/tbMainLocation"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="#drawable/location_selector"
android:focusable="false"
android:focusableInTouchMode="false"
android:textOff=""
android:textOn="" />
</RelativeLayout>
<LinearLayout
android:id="#+id/llExpertfragmentChooseDistance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl_liv_top_bar"
android:background="#color/light_cyan"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:visibility="gone" >
<TextView
android:id="#+id/txt_choose_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:layout_marginRight="2dp"
android:maxWidth="60dp"
android:paddingLeft="10dp"
android:text="#string/choose_distance"
android:textSize="10dp" />
<ImageView
android:id="#+id/img_expert_earn_by_walk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/walk_normal" />
<TextView
android:id="#+id/txt_cycle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:layout_marginLeft="-2dp"
android:layout_marginRight="-2dp"
android:background="#color/cyan_line"
android:maxHeight="6dp"
android:minWidth="40dp" />
<ImageView
android:id="#+id/img_expert_earn_by_cycle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cycle_normal" />
<TextView
android:id="#+id/txt_bike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:layout_marginLeft="-2dp"
android:layout_marginRight="-2dp"
android:background="#color/cyan_line"
android:maxHeight="6dp"
android:minWidth="40dp" />
<ImageView
android:id="#+id/img_expert_earn_by_bike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/car_normal" />
<TextView
android:id="#+id/txt_train"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:layout_marginLeft="-2dp"
android:layout_marginRight="-2dp"
android:background="#color/cyan_line"
android:maxHeight="6dp"
android:minWidth="40dp" />
<ImageView
android:id="#+id/img_expert_earn_by_flight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/plane_normal" />
</LinearLayout>
</RelativeLayout>
fragmentactivity.xml
<com.liv.slidingmenu.layout.MainLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- This holds our menu -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ll_top_menu_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#6d6d6d"
android:orientation="vertical" >
<!-- This acts as Actionbar -->
<LinearLayout
android:id="#+id/ll_prof_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#434242" >
<RelativeLayout
android:id="#+id/rr_img_detail"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/img_prof"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/profile_image" />
<TextView
android:id="#+id/txt_expt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img_leve"
android:layout_marginLeft="35dp"
android:layout_marginTop="35dp"
android:layout_toRightOf="#+id/img_prof"
android:text=""
android:textColor="#ffffff" />
<TextView
android:id="#+id/txt_level"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_below="#+id/txt_expt_name"
android:layout_marginLeft="35dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/img_prof"
android:background="#drawable/level_background"
android:gravity="center_horizontal"
android:paddingTop="5dp"
android:text=""
android:textColor="#d2d2d2" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_prof_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.6" >
<ListView
android:id="#+id/listview_menu_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#292929"
android:dividerHeight="0.1dip" >
</ListView>
</LinearLayout>
</LinearLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/ll_topbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<include
android:id="#+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="#layout/layout_include" />
</RelativeLayout>
<TabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_below="#+id/ll_topbar" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="-3dp"
android:orientation="vertical" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="#+android:id/realtabcontents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<!-- android:id="#android:id/tabs" -->
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#f9f9f9"
android:orientation="horizontal" />
</LinearLayout>
</TabHost>
</RelativeLayout>
</com.liv.slidingmenu.layout.MainLayout>

To access views that belong to the activity layout you can use
getActivity().findViewById(R.id.viewid);
Make sure the fragment is attached to the activity and getActivity() does not return null.
Quoting docs
The fragment can access the Activity instance with getActivity() and
easily perform tasks such as find a view in the activity layout
http://developer.android.com/guide/components/fragments.html

Related

How can I implement a scrollview in my RelativeLayout

Please I have a RelativeLayout and I have a section in my Layout I would like to make scrollable, this selection below. Please kindly answer using my full code. thank you.
<FrameLayout
android:id="#+id/layouts"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/iv_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</FrameLayout>
This is the full code below:-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/color12" >
<LinearLayout
android:id="#+id/menus"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<include layout="#layout/menu_layout" />
</LinearLayout>
<RelativeLayout
android:id="#+id/rl_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/menu_layout"
android:layout_below="#+id/menus" >
<FrameLayout
android:id="#+id/layouts"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/iv_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</FrameLayout>
<FrameLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" >
<ImageView
android:id="#+id/iv_notes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:visibility="gone" />
</FrameLayout>
<LinearLayout
android:id="#+id/top_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:id="#+id/lblDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:textColor="#222222"
android:textSize="#dimen/title" />
<TextView
android:id="#+id/lblTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:textSize="#dimen/title"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/lblTotal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="#222222"
android:textSize="#dimen/title" />
</LinearLayout>
</LinearLayout>
<EditText
android:id="#+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/top_layout"
android:layout_marginBottom="5dp"
android:background="#null"
android:inputType="textMultiLine"
android:textSize="#dimen/title_size" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/bottom_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/menu_layout"
android:orientation="horizontal" >
<RelativeLayout
android:id="#+id/attach_view"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:visibility="gone" >
<TextView
android:id="#+id/attachment_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/aImage"
android:ellipsize="start"
android:padding="2dp"
android:singleLine="true"
android:text="Attachment"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#222222" />
<ImageButton
android:id="#+id/aImage"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="3dp"
android:background="#drawable/bottom_bar"
android:padding="10dp"
android:src="#drawable/ic_email_attachment" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/bot_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/attach_view"
android:orientation="horizontal" >
<ImageView
android:id="#+id/lblRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:padding="10dp"
android:src="#drawable/tool_left"
android:visibility="gone" />
<ImageView
android:id="#+id/lblLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="10dp"
android:src="#drawable/tool_right"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/menu_layout"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:background="#ffffff"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="right"
android:layout_weight="1"
android:orientation="horizontal" >
<include
android:id="#+id/tool_text_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
layout="#layout/tool_text_button_layout"
android:padding="13dp" />
<!--
<ImageView
android:id="#+id/menu_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="#string/content_desc"
android:padding="13dp"
android:src="#drawable/tool_type_text" />
-->
<ImageView
android:id="#+id/menu_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:contentDescription="#string/content_desc"
android:padding="5dp"
android:src="#drawable/tool_thumbs" />
<ImageView
android:id="#+id/menu_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:contentDescription="#string/content_desc"
android:padding="5dp"
android:src="#drawable/sync"
android:visibility="visible" />
<ImageView
android:id="#+id/menu_attachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:contentDescription="#string/content_desc"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="#drawable/ic_email_attachment_small"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="right"
android:layout_weight="1"
android:orientation="horizontal" >
<ImageView
android:id="#+id/menu_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:contentDescription="#string/content_desc"
android:paddingBottom="5dp"
android:paddingTop="7dp"
android:src="#drawable/ic_bold"
android:visibility="gone" />
<ImageView
android:id="#+id/menu_italics"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:contentDescription="#string/content_desc"
android:paddingBottom="5dp"
android:paddingTop="7dp"
android:src="#drawable/ic_italics"
android:visibility="gone" />
<ImageView
android:id="#+id/menu_underline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:contentDescription="#string/content_desc"
android:paddingBottom="5dp"
android:paddingTop="7dp"
android:src="#drawable/ic_underline"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<ListView
android:id="#+id/list_mode"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/menus"
android:background="#android:color/background_dark"
android:divider="#ffffff"
android:dividerHeight="1dp"
android:visibility="gone" >
</ListView>
<LinearLayout
android:id="#+id/attach_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#android:color/background_light"
android:orientation="vertical"
android:visibility="gone" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<Button
android:id="#+id/Image"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/bottom_bar"
android:text="Add Image"
android:textColor="#222222" />
<Button
android:id="#+id/Audio"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/bottom_bar"
android:text="Add Audio"
android:textColor="#222222" />
<Button
android:id="#+id/Video"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/bottom_bar"
android:text="Add Video"
android:textColor="#222222" />
</LinearLayout>
<ListView
android:id="#+id/mList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/bottom_bar"
android:gravity="center"
android:text="Save"
android:textColor="#222222"
android:visibility="gone"
android:width="100dp" />
<Button
android:id="#+id/btncancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/bottom_bar"
android:gravity="center"
android:text="Exit"
android:textColor="#222222"
android:visibility="visible"
android:width="100dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
You need to put some layout (linear/relative) in the scrollView in place you needed and inside this layout put your frameLayout
Just put a <ScrollView> around the elements you want to be scrolled. If I understood you right, this is this fragment:
<FrameLayout
android:id="#+id/layouts"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/iv_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</FrameLayout>
This should solve your problem :
<ScrollView
android:layout_width="match_parent"
android:layout_height="20dp"
android:id="#+id/scrollView">
<FrameLayout
android:id="#+id/layouts"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/iv_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</FrameLayout>
</ScrollView>

Make style for single listview item (unwanted scaling)

Hey i wanna make specific single item row for my listView but don't know exacly how to handle it.
i.stack.imgur.com/9fUmX.png
I made something like this using weights on linear layout but it's not working correctly when additional info is too long.
i.stack.imgur.com/uG43j.png
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#55000000" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:orientation="horizontal"
android:weightSum="10" >
<!-- pomysle jeszcze nad wagami -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="2" >
<RelativeLayout
android:layout_width="60dp"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<TextView
android:id="#+id/JsonItemDataNumberOfTheDayFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="21"
android:textColor="#FFF"
android:textSize="15sp" />
<TextView
android:id="#+id/JsonItemDataMonthFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/JsonItemDataNumberOfTheDayFree"
android:layout_centerHorizontal="true"
android:text="CZE"
android:textColor="#FFF"
android:textSize="13sp" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- tu nie jestem pewny margin top? -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/JsonItemTitleEventFree"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:singleLine="true"
android:text="Title"
android:textColor="#android:color/white"
android:textSize="18sp" />
<TextView
android:id="#+id/JsonItemAdditionalInfoFree"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="Additional Info"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/JsonItemDateFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dp"
android:text="Date"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="20dp"
android:layout_height="100dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/JsonItemLogoCategoryFree"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/category_music"
android:scaleType="fitStart" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
try this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="2" >
<RelativeLayout
android:layout_width="60dp"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<TextView
android:id="#+id/JsonItemDataNumberOfTheDayFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="21"
android:textColor="#FFF"
android:textSize="15sp" />
<TextView
android:id="#+id/JsonItemDataMonthFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/JsonItemDataNumberOfTheDayFree"
android:layout_centerHorizontal="true"
android:text="CZE"
android:textColor="#FFF"
android:textSize="13sp" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_gravity="top"
android:id="#+id/JsonItemTitleEventFree"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:singleLine="true"
android:text="Title"
android:textColor="#android:color/white"
android:textSize="18sp" />
<TextView
android:id="#+id/JsonItemAdditionalInfoFree"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="Additional Info"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/JsonItemDateFree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dp"
android:text="Date"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="20dp"
android:layout_height="100dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/JsonItemLogoCategoryFree"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/category_music"
android:scaleType="fitStart" />
</LinearLayout>

expandable listview scrolling

in my application I have 3 expandableListview as shown here.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="280dp"
android:layout_height="fill_parent"
android:background="#color/filter_items_background"
android:layout_gravity="end"
android:clickable="true"
android:orientation="vertical" >
<!-- Gender -->
<TextView
android:id="#+id/listSelectionHeaderTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/filter_groups_background"
android:gravity="center_vertical"
android:minHeight="#dimen/filterFragment__itemHeight"
android:paddingLeft="20dp"
android:text="#string/filter_interestedin"
android:textColor="#8F8F8F"
android:textSize="20sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/filter_items_background"
android:minHeight="#dimen/filterFragment__itemHeight"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/men_itemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="#string/filter_men"
android:textColor="#android:color/white"
android:textSize="16sp" />
<ToggleButton
android:id="#+id/men_toggleButton"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/custom_switch_drawable"
android:textOff=""
android:textOn="" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/filter_items_background"
android:minHeight="#dimen/filterFragment__itemHeight"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/women_itemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="#string/filter_women"
android:textColor="#android:color/white"
android:textSize="16sp" />
<ToggleButton
android:id="#+id/women_toggleButton"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/custom_switch_drawable"
android:textOff=""
android:textOn="" />
</RelativeLayout>
<!-- Age -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/filter_groups_background"
android:gravity="center_vertical"
android:minHeight="#dimen/filterFragment__itemHeight"
android:orientation="horizontal"
android:paddingRight="10dp" >
<TextView
android:id="#+id/ageHeaderTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:paddingLeft="20dp"
android:text="#string/filter_age"
android:textColor="#8F8F8F"
android:textSize="20sp" />
<TextView
android:id="#+id/ageValuesTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingLeft="20dp"
android:text="Sample"
android:textColor="#android:color/white"
android:textSize="20sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/filter_items_background"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="10dp" >
<SeekBar
android:id="#+id/age_seekBar_from"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<SeekBar
android:id="#+id/age_seekBar_to"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<ExpandableListView
android:id="#+id/expandableListView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:background="#000000"
android:groupIndicator="#android:color/transparent"
android:saveEnabled="true" />
<ExpandableListView
android:id="#+id/expandableListView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:background="#000000"
android:groupIndicator="#android:color/transparent"
android:saveEnabled="true" />
<ExpandableListView
android:id="#+id/expandableListView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:background="#000000"
android:groupIndicator="#android:color/transparent"
android:saveEnabled="true" />
</LinearLayout>
</LinearLayout>
My problem is when I open one of expandablelistview the others expandablelistview not showing... I want open one child of expandablelistview and enable scroll and others expandablelistview.

how to center relative layout in linearlayout

I want to center horizontally and vertically block L3 on this image, can you help me with the layout structure to use. ON the right side is current structure of the menu. Thanks.
Here is the layout.xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/BaseLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/mainmenu_background" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_background" />
<LinearLayout
android:id="#+id/l1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- Top menu -->
<LinearLayout
android:id="#+id/l2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RelativeLayout
android:id="#+id/TopMenuHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/main_menu_background_header"
android:gravity="left"
android:orientation="horizontal"
android:visibility="visible" >
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="#drawable/logo" />
<LinearLayout
android:id="#+id/TopRightButtonsHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="horizontal"
android:visibility="visible" >
<RelativeLayout
android:id="#+id/sinscrire"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/login_registerbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_sinscrire_button" />
<TextView
android:id="#+id/sinscrire_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/cpr_sinscrite_title_text"
android:textColor="#color/cpr_menubutton_black"
android:textSize="#dimen/cpr_small_menubutton_title_text_size"
android:textStyle="bold|italic" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/connexion"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/login_loginbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_logout_button" />
<TextView
android:id="#+id/connexion_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/cpr_connexion_title_text"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_small_menubutton_title_text_size"
android:textStyle="bold|italic" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<!-- End of Top menu -->
<!-- Middle menu -->
<LinearLayout
android:id="#+id/l3"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/MiddleMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal" >
<LinearLayout
android:id="#+id/MiddleLeftButtonsHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:orientation="horizontal"
android:visibility="visible" >
<RelativeLayout
android:id="#+id/Parametres"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/optionsmenu_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_options_button" />
<LinearLayout
android:id="#+id/options_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="left"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/options_icon" />
<TextView
android:id="#+id/parametres_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cpr_parametres_title_text"
android:textColor="#color/cpr_menubutton_black"
android:textSize="#dimen/cpr_small_menubutton_title_text_size"
android:textStyle="bold|italic" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/Aide"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/optionsmenu_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_help_button" />
<LinearLayout
android:id="#+id/help_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="left"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/help_icon" />
<TextView
android:id="#+id/aide_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cpr_aide_title_text"
android:textColor="#color/cpr_menubutton_black"
android:textSize="#dimen/cpr_small_menubutton_title_text_size"
android:textStyle="bold|italic" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/MiddleRightButtonsHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/MiddleLeftButtonsHolder"
android:orientation="horizontal"
android:visibility="visible" >
<RelativeLayout
android:id="#+id/Caisse"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/cashiericon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_cashier_button" />
<LinearLayout
android:id="#+id/caisse_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="left"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cashier_icon" />
<TextView
android:id="#+id/caisse_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cpr_caisse_title_text"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_small_menubutton_title_text_size"
android:textStyle="bold|italic" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- End of Middle menu -->
<!-- Main menu -->
<RelativeLayout
android:id="#+id/MainMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/MiddleMenu"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="#+id/main_menu_black_rect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:src="#drawable/main_menu_black_rect" />
<RelativeLayout
android:id="#+id/play_for_real"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="20dp" >
<ImageButton
android:id="#+id/realmoneybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitStart"
android:src="#drawable/main_menu_play_for_real_button" />
<ImageView
android:id="#+id/play_for_real_img_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/realmoneybutton"
android:layout_alignRight="#id/realmoneybutton"
android:background="#color/transparent"
android:src="#drawable/main_menu_play_for_real_button_icon" />
<LinearLayout
android:id="#+id/play_for_money_text_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/play_for_real_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cpr_play_for_real_title_text"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_menubutton_title_text_size"
android:textStyle="bold" />
<TextView
android:id="#+id/play_for_real_desc"
android:layout_width="221dp"
android:layout_height="wrap_content"
android:text="#string/cpr_play_for_real_title_desc"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_menubutton_desc_text_size" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/play_for_fun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/play_for_real"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" >
<ImageButton
android:id="#+id/playmoneybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_play_for_fun_button" />
<ImageView
android:id="#+id/play_for_fun_img_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/playmoneybutton"
android:layout_alignRight="#id/playmoneybutton"
android:background="#color/transparent"
android:src="#drawable/main_menu_play_for_fun_button_icon" />
<LinearLayout
android:id="#+id/play_for_fun_text_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/play_for_fun_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cpr_play_for_fun_title_text"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_menubutton_title_text_size"
android:textStyle="bold" />
<TextView
android:id="#+id/play_for_fun_desc"
android:layout_width="221dp"
android:layout_height="wrap_content"
android:text="#string/cpr_play_for_fun_title_desc"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_menubutton_desc_text_size" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/tutoriel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/play_for_fun"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" >
<ImageButton
android:id="#id/previewbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#drawable/main_menu_tutorial_button" />
<TextView
android:id="#+id/tutoriel_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="#string/cpr_tutoriel_title_text"
android:textColor="#color/cpr_menubutton_white"
android:textSize="#dimen/cpr_menubutton_title_text_size"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<!-- End of Main menu -->
</LinearLayout>
<!-- End of Main Container -->
</RelativeLayout>
Here is a Linear Layout with a Relative Layout centered inside.
Move your code from the "l3" layout to the "l4" layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/l1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/l2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#56a"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="l2" />
</LinearLayout>
<RelativeLayout
android:id="#+id/l3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a56" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="l3" />
<RelativeLayout
android:id="#+id/l4"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#5a6" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="l4" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

How to make Full screen vertical scroll view with List view in that

i want to make this page in vertical scroll view mode but there is one list view which you can see below,i have listview items which are coming from web service
Main Problem:
My screen is scrolling but listview item are not scrollable I can only find first result from web service
I used fill_parent property in xml still listview item is showing in small window.
Anyone please tell me how to create this type of screen I have search this on net but did't get any correct idea..thank you
here is my Xml file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="#+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/main_back_ground" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="50dp" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<include
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="#layout/header_mf" />
<ImageButton
android:id="#+id/imageButton"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_gravity="right|center"
android:layout_marginRight="15dp"
android:background="#drawable/cg_report_btn" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_gravity="top"
android:layout_marginTop="50dp"
android:src="#drawable/header_yellow_line" />
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_gravity="top"
android:src="#drawable/header_yellow_line" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="vertical" >
<TextView
android:id="#+id/backkground_img_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:text="Violin Genius takes the highschool championships"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="12dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:text="#string/gallery_assignment_name"
android:textSize="10dp" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="200dp" >
<ImageView
android:id="#+id/imgViewGalleryBackgroundPic"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_gravity="center"
android:background="#drawable/u15_normal"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_gravity="bottom"
android:background="#drawable/app_feed"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imgViewDetailTumbNail"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/u17_normal_small" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Vote ."
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Comment ."
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Share"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/gallery_detail_person_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="3dp"
android:text="#string/gallery_person_name"
android:textSize="8dp" />
<TextView
android:id="#+id/gallery_detail_views"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="0"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/view_icon" />
<TextView
android:id="#+id/gallery_detail_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="3dp"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/comment_icon" />
<TextView
android:id="#+id/gallery_detail_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/heart_icon" />
<TextView
android:id="#+id/gallery_detail_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="8dp" />
<ImageButton
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:background="#drawable/pin" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#drawable/divider_line" />
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="70dp"
android:fillViewport="true" >
<TextView
android:id="#+id/gallery_image_detail"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:singleLine="false"
android:text="#string/gallery_assignment_detail"
android:textSize="8dp" >
</TextView>
</ScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="#+id/mapViewGallery"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:apiKey="0X_Jyk3FLOVfS4dJSGin89ME-m3u3QBwVFkXpvQ"
android:clickable="true"
android:enabled="true" >
</com.google.android.maps.MapView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- <ListView -->
<!-- android:id="#+id/listViewGalleryDetail" -->
<!-- android:layout_width="fill_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:cacheColorHint="#00000000" -->
<!-- android:padding="5dp" > -->
<!-- </ListView> -->
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
i have resolved my issue with use of listview.addHeaderView(view); with use of this property i have added my second view on top of my list view and its working like charm.
one thing that we have to make sure that,we must call this method before calling setAdapter() of our listview.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.6"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="#+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/main_back_ground" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="50dp" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<include
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="#layout/header_mf" />
<ImageButton
android:id="#+id/imageButton"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_gravity="right|center"
android:layout_marginRight="15dp"
android:background="#drawable/cg_report_btn" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_gravity="top"
android:layout_marginTop="50dp"
android:src="#drawable/header_yellow_line" />
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_gravity="top"
android:src="#drawable/header_yellow_line" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="vertical" >
<TextView
android:id="#+id/backkground_img_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:text="Violin Genius takes the highschool championships"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="12dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:text="#string/gallery_assignment_name"
android:textSize="10dp" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="200dp" >
<ImageView
android:id="#+id/imgViewGalleryBackgroundPic"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_gravity="center"
android:background="#drawable/u15_normal"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_gravity="bottom"
android:background="#drawable/app_feed"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imgViewDetailTumbNail"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/u17_normal_small" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Vote ."
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Comment ."
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Share"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/gallery_detail_person_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="3dp"
android:text="#string/gallery_person_name"
android:textSize="8dp" />
<TextView
android:id="#+id/gallery_detail_views"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="0"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/view_icon" />
<TextView
android:id="#+id/gallery_detail_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="3dp"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/comment_icon" />
<TextView
android:id="#+id/gallery_detail_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="8dp" />
<ImageView
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#drawable/heart_icon" />
<TextView
android:id="#+id/gallery_detail_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="8dp" />
<ImageButton
android:id="#+id/imageButton"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:background="#drawable/pin" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#drawable/divider_line" />
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="70dp"
android:fillViewport="true" >
<TextView
android:id="#+id/gallery_image_detail"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:singleLine="false"
android:text="#string/gallery_assignment_detail"
android:textSize="8dp" >
</TextView>
</ScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="#+id/mapViewGallery"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:apiKey="0X_Jyk3FLOVfS4dJSGin89ME-m3u3QBwVFkXpvQ"
android:clickable="true"
android:enabled="true" >
</com.google.android.maps.MapView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.4" >
<ListView
android:id="#+id/listViewGalleryDetail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:padding="5dp" >
</ListView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Try this
you can scroll both of the scroll view using this trick .
It worked for me .
Suppose you have two scroll view L1 is inside L2 then use this code in JAVA.
L1.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View arg0, MotionEvent arg1) {
if(arg1.getAction() == MotionEvent.ACTION_DOWN || arg1.getAction() == MotionEvent.ACTION_MOVE)
{
L2.requestDisallowInterceptTouchEvent(true);
}
return false;
}
});
With this you can scroll both of the scroll view

Categories

Resources