Reputation:
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>
Upvotes: 2
Views: 10269
Reputation:
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.
Upvotes: 2
Reputation: 2930
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
Upvotes: 0
Reputation: 3868
<?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
Upvotes: 1