Scrollview inside scrollview in android - android

I am having scrollview inside another scrollview. I want to scroll inner scrollview but outer scrollview is only scrolled.how to solve this problem?
Thanks.

sv01 = (ScrollView) findViewById(R.id.popup_sf_event_scroll_01);
sv02 = (ScrollView) findViewById(R.id.popup_sf_event_scroll_02);
sv02.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP)
sv01.requestDisallowInterceptTouchEvent(false);
else
sv01.requestDisallowInterceptTouchEvent(true);
return false;
}
});

in scroll view take one layout and add another scrollview in that layout coz scrollview can hold only one child in it. So that inner scrollview can move for what it is holding in it.

Related

ListView scrolling not working inside scrollView. it is creating jerk

i have integrated listView inside the scrollView. im facing issue while vertical scrolling. how to fix this issue ?
ListView inside the scrollView is an bad programming practice. ListView aleary has its own scrolling functionality and you are again embedding it into the scrollView that why it is creating an jerk.
Don't use listView inside the scrollView.
If you want to scroll let's say listView and not whole scrollView you could try this code. However, it is not good idea to place listView inside of scrollview. Your users may find it uncomfortable.
yourListView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.yourListView) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});

ExpandableListView inside RecyclerView inside a ViewPager

I'm facing problems in scrolling. I've the following structure in order in my project:
1) ViewPager
2) RecyclerView
3) ExpandableListView
I cannot scroll the ExpandableListView; but I can scroll RecyclerView. I tried setNestedScrolling but i didn't work.
Any solutions?
I think what you need to do is disable the scroll of the parent when you touch the child. So this should work
mListView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
//Disallow the touch request for parent scroll on touch of child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});

Remove scroll event for a ScrollView child

Is it possible to remove scroll event for a layout that is inside a ScrollView?
I have the following layout hierarchy:
ScrollView
RelativeLayout
LinearLayout
TableLayout
RelativeLayout
GestureOverlayView
I want to remove the scroll event for the RelativeLayout that contains a GestureOverlayView so that when the user draws a vertical line, the event is not intercepted as scroll but as drawing.
I don'y know you still need that or not but here is the answer I tested.
this is how you prevent the parent View from stealing touchEvent of a child view:
childView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.childView) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});
you can go up in parents by:
v.getParent().getParent ....

Is there any way to scroll the scrollbar of gridview/listview inside Scrollview?

Hi in my application the screen is so large which contains a gridview with images and listview with lot of list items and also so many text views existed in my screen. so that i placed this content in scrollview to view on the mobile screen. When I placed the content in the scrollview then the gridview/listview scroll is not working.
Is there any way to solve this issue. I referred so many links but i could not get the solution.
The links are
Grid of images inside ScrollView
How can I put a ListView into a ScrollView without it collapsing?
etc
You can solve it using following code, but I suggest please change UI, it is not according android guideline. it' easily scrolled in iPhone interface.
final ScrollView childScroll = (ScrollView)
view.findViewById(R.id.resourceactivity_sv_classes_detail);
parentScroll.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
//Log.v(TAG,"PARENT TOUCH");
childScroll.getParent().requestDisallowInterceptTouchEvent
(false); return false; } }); childScroll.setOnTouchListener(new
View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
//Log.v(TAG,"CHILD TOUCH");
v.getParent().requestDisallowInterceptTouchEvent(true); return
false; } });
You can modify gridview instead of child scrollview.

text scroll inside edittext of a linear layout which in scrollview in android

I have an UI issue like, some EditText s are there in LinearLayout ,and this linear layout is placed in scroll view . now what i want to do is edit text has large amount of data for seeing this data i have set android:scrollbars ="vertical" by this i'm able to see the scroll bar inside the edit text but the data is not scrolling. out side scrollbar is moving.how to fix this issue.
can anybody help me. Thanks in Advance.
This may help you....
parentScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Log.v(TAG,"PARENT TOUCH");
findViewById(R.id.child_scroll).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event)
{
Log.v(TAG,"CHILD TOUCH");
// Disallow the touch request for parent scroll on touch of child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
In your case 'parentScrollView' is your scrollView while childScrollView is your Linearlayout/EditText
Use yourEditTextView.setMovementMethod(new ScrollingMovementMethod());

Categories

Resources