[android-developers] Re: Scroll View
I still want to scroll the view to the right or left using two buttons in my app. I got this far, but this doesn't work. Please help!! public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if(v.getId() == MotionEvent.ACTION_DOWN){ scroll = 1; }else if(v.getId() == MotionEvent.ACTION_UP){ scroll = 0; } switch (v.getId()) { case R.id.bRight: while (scroll == 1) { sw.scrollBy(5, 0); } case R.id.bLeft: while (scroll == 1) { sw.scrollBy(-5, 0); } } return false; } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
On Fri, Jan 27, 2012 at 3:38 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I got this far, but this doesn't work. You should generally explain what doesn't work means, but I can tell from your code that you're locking the UI and getting an ANR, right? You can't just do while (some condition that has just been set to true) within the main thread. That puts you in an infinite loop and gets you stuck. You need to do something like this: onMotionEvent(View view) { if (action down) { // Pressed down on a button, save it and start the scroll timer (onTimerTick) viewClicked = view; startScrollTimer(); } else if (action up) stopScrollTimer(); // Released the button, stop the timer (and thus the scrolling) } onTimerTicker() { if (viewClicked == left) scrollLeft(); else if (viewClicked == right) scrollRight(); } There are multiple ways to do the timer logic, Kostya showed you one. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Scroll View
I have tried those events. I need to use a while loop, but when i use it within my ontouch i get an error on my device, it goes forever. I read somewhere i need to put it in a new thread. Can you please show me how can i do that? On Jan 26, 5:09 am, TreKing treking...@gmail.com wrote: On Wed, Jan 25, 2012 at 4:04 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I cannot get this to work. When i press the button it registers as a single click, then it releases the touch. HELP!!! Have you tried all of the motion-centric events described here:http://developer.android.com/reference/android/view/View.html? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
On Thu, Jan 26, 2012 at 10:34 AM, Oliviu Vais oliviu.v...@gmail.com wrote: I have tried those events. I need to use a while loop, but when i use it within my ontouch i get an error on my device, it goes forever. Well, yeah. I read somewhere i need to put it in a new thread. Where was that? Can you please show me how can i do that? Nope, sorry. But that probably wouldn't work anyway. While it would prevent you from blocking the UI thread, there's still the minor detail of knowing when to *stop*. There must be some event that indicates when a touch has stopped. When you find how to do that, everything else should fall into place. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
Rather than using a thread, you might want to schedule a task delayed by a certain amount. There are several ways to do this with the Android framework, here is one: http://developer.android.com/reference/android/view/View.html#postDelayed(java.lang.Runnable, long) -- K 26 января 2012 г. 20:34 пользователь Oliviu Vais oliviu.v...@gmail.comнаписал: I have tried those events. I need to use a while loop, but when i use it within my ontouch i get an error on my device, it goes forever. I read somewhere i need to put it in a new thread. Can you please show me how can i do that? On Jan 26, 5:09 am, TreKing treking...@gmail.com wrote: On Wed, Jan 25, 2012 at 4:04 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I cannot get this to work. When i press the button it registers as a single click, then it releases the touch. HELP!!! Have you tried all of the motion-centric events described here: http://developer.android.com/reference/android/view/View.html? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Scroll View
I cannot get this to work. When i press the button it registers as a single click, then it releases the touch. HELP!!! On Jan 24, 11:47 pm, TreKing treking...@gmail.com wrote: On Tue, Jan 24, 2012 at 3:06 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I thought it's clear enough. Nope =) I need help for the Java class, i cant get my buttons to scroll continous, they scroll only once when i click them. I need them to scroll to the end of the View but not at once, in little continous steps. This is what i have so far: A - see, that makes a lot more sense than here's some code, what's wrong. I don't know much about the onTouchEvent, but I would guess by the name and what you described that it get's called once, when the view is initially touched, and not continuously as you're wanting to do. Does the method get called when you release as well? If so, or if there is another event that tells you that, you could start a timer on the initial touch which you use to control the scrolling of the view, and then stop it when the view stops being touched. --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
On Wed, Jan 25, 2012 at 4:04 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I cannot get this to work. When i press the button it registers as a single click, then it releases the touch. HELP!!! Have you tried all of the motion-centric events described here: http://developer.android.com/reference/android/view/View.html? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Scroll View
Anybody? I am really stuck with this. Any idea is useful. On Jan 23, 5:18 pm, Oliviu Vais oliviu.v...@gmail.com wrote: I am trying to scroll a HorizontalScrollView by 2 buttons, one left, one right. What am i doing wrong? Which one to choose? sw - scroll view public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bRight: sw.smoothScrollBy(20, 0); break; case R.id.bLeft: sw.smoothScrollBy(-20, 0); break; } return false; } public boolean onLongClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()){ case R.id.bRight: sw.smoothScrollBy(50, 0); break; } return false; -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Scroll View
I thought it's clear enough. I have a HorizontalScrollView at the bottom of my screen. I want to scroll it left and right by using 2 buttons that are on each side(one for left scroll, one for right). I do not need help in setting the Xml. I need help for the Java class, i cant get my buttons to scroll continous, they scroll only once when i click them. I need them to scroll to the end of the View but not at once, in little continous steps. This is what i have so far: public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bRight: sw.smoothScrollBy(20, 0); break; case R.id.bLeft: sw.smoothScrollBy(-20, 0); break; } return false; On Jan 24, 9:42 pm, Marcelo Henrique marceloh...@gmail.com wrote: xml logcat ?xml version=1.0 encoding=utf-8? ScrollView android:id=@+id/ScrollView02 android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android; HorizontalScrollView android:id=@+id/HorizontalScrollView01 android:layout_width=wrap_content android:layout_height=wrap_content ImageView android:id=@+id/ImageView01 android:src=@drawable/pic android:isScrollContainer=true android:layout_height=fill_parent android:layout_width=fill_parent android:adjustViewBounds=true /ImageView /HorizontalScrollView /ScrollView 2012/1/24 TreKing treking...@gmail.com On Mon, Jan 23, 2012 at 9:18 AM, Oliviu Vais oliviu.v...@gmail.comwrote: What am i doing wrong? Well you didn't really explain what the problem is. I'm trying to do X is not a problem. What have you debugged and learned so far? What is actually not working? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- - Marcelo Henrique - Se não puder se destacar pelo talento, vença pelo esforço. (Dave Weinbaum) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
you need viewpager http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html http://developer.android.com/reference/android/support/v4/view/ViewPager.html 2012/1/24 Oliviu Vais oliviu.v...@gmail.com I thought it's clear enough. I have a HorizontalScrollView at the bottom of my screen. I want to scroll it left and right by using 2 buttons that are on each side(one for left scroll, one for right). I do not need help in setting the Xml. I need help for the Java class, i cant get my buttons to scroll continous, they scroll only once when i click them. I need them to scroll to the end of the View but not at once, in little continous steps. This is what i have so far: public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bRight: sw.smoothScrollBy(20, 0); break; case R.id.bLeft: sw.smoothScrollBy(-20, 0); break; } return false; On Jan 24, 9:42 pm, Marcelo Henrique marceloh...@gmail.com wrote: xml logcat ?xml version=1.0 encoding=utf-8? ScrollView android:id=@+id/ScrollView02 android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android; HorizontalScrollView android:id=@+id/HorizontalScrollView01 android:layout_width=wrap_content android:layout_height=wrap_content ImageView android:id=@+id/ImageView01 android:src=@drawable/pic android:isScrollContainer=true android:layout_height=fill_parent android:layout_width=fill_parent android:adjustViewBounds=true /ImageView /HorizontalScrollView /ScrollView 2012/1/24 TreKing treking...@gmail.com On Mon, Jan 23, 2012 at 9:18 AM, Oliviu Vais oliviu.v...@gmail.com wrote: What am i doing wrong? Well you didn't really explain what the problem is. I'm trying to do X is not a problem. What have you debugged and learned so far? What is actually not working? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- - Marcelo Henrique - Se não puder se destacar pelo talento, vença pelo esforço. (Dave Weinbaum) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- - Marcelo Henrique - Se não puder se destacar pelo talento, vença pelo esforço. (Dave Weinbaum) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Scroll View
I don't think so. This viewpager is for dragging. On Jan 24, 11:23 pm, Marcelo Henrique marceloh...@gmail.com wrote: you need viewpager http://android-developers.blogspot.com/2011/08/horizontal-view-swipin... http://developer.android.com/reference/android/support/v4/view/ViewPa... 2012/1/24 Oliviu Vais oliviu.v...@gmail.com I thought it's clear enough. I have a HorizontalScrollView at the bottom of my screen. I want to scroll it left and right by using 2 buttons that are on each side(one for left scroll, one for right). I do not need help in setting the Xml. I need help for the Java class, i cant get my buttons to scroll continous, they scroll only once when i click them. I need them to scroll to the end of the View but not at once, in little continous steps. This is what i have so far: public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bRight: sw.smoothScrollBy(20, 0); break; case R.id.bLeft: sw.smoothScrollBy(-20, 0); break; } return false; On Jan 24, 9:42 pm, Marcelo Henrique marceloh...@gmail.com wrote: xml logcat ?xml version=1.0 encoding=utf-8? ScrollView android:id=@+id/ScrollView02 android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android; HorizontalScrollView android:id=@+id/HorizontalScrollView01 android:layout_width=wrap_content android:layout_height=wrap_content ImageView android:id=@+id/ImageView01 android:src=@drawable/pic android:isScrollContainer=true android:layout_height=fill_parent android:layout_width=fill_parent android:adjustViewBounds=true /ImageView /HorizontalScrollView /ScrollView 2012/1/24 TreKing treking...@gmail.com On Mon, Jan 23, 2012 at 9:18 AM, Oliviu Vais oliviu.v...@gmail.com wrote: What am i doing wrong? Well you didn't really explain what the problem is. I'm trying to do X is not a problem. What have you debugged and learned so far? What is actually not working? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- - Marcelo Henrique - Se não puder se destacar pelo talento, vença pelo esforço. (Dave Weinbaum) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- - Marcelo Henrique - Se não puder se destacar pelo talento, vença pelo esforço. (Dave Weinbaum) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scroll View
On Tue, Jan 24, 2012 at 3:06 PM, Oliviu Vais oliviu.v...@gmail.com wrote: I thought it's clear enough. Nope =) I need help for the Java class, i cant get my buttons to scroll continous, they scroll only once when i click them. I need them to scroll to the end of the View but not at once, in little continous steps. This is what i have so far: A - see, that makes a lot more sense than here's some code, what's wrong. I don't know much about the onTouchEvent, but I would guess by the name and what you described that it get's called once, when the view is initially touched, and not continuously as you're wanting to do. Does the method get called when you release as well? If so, or if there is another event that tells you that, you could start a timer on the initial touch which you use to control the scrolling of the view, and then stop it when the view stops being touched. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: scroll view and TableLayout
Try creating the headers by hand, say, with a TextView, and put your ScrollView containing the TableLayout underneath it. On Apr 29, 11:44 pm, rahulp rahul.d.notori...@gmail.com wrote: Hi I have a Scrollview Table Layout. In which i have a header column and another header row. I want toscrollthe table without scrolling the headers. Ie i want to selectively stop scrolling of the top row and first column. Can anyone please hel[p me out.. PLEASE i need this to work -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en