Adding scrollbars in a Custom View

by Neha » Fri, 05 Mar 2010 18:15:40 GMT


Sponsored Links
 Hi,

I am working on adding vertical and horizontal scrollbars in a custom
drawn View. I have overridden the compute*ScrollOffset,
compute*ScrollRange, etc methods and have enabled the scrollbars by
called set*ScrollBarEnabled. However, I do not see the scrollbars in
my View, even after a call to scrollBy, which according to the
documentation calls awakenScrollbars (I assumed awakenScrollbars is
not required as the scrollbars do not auto-fade -
isScrollbarFadingEnabled returns false).
Does anyone have a sample with scrollbars in a custom view which they
can share? Or provide any pointers as to how this should be fixed?

Any help would be appreciated.
Thanks!

--



Adding scrollbars in a Custom View

by Jonas » Fri, 23 Apr 2010 08:04:53 GMT


 Hi,

Did you get any help with this question, I am having the same problem.
No scroll bars are displayed. I also wish to get the Y position of the
scrollbar and see if it is bigger or smaller than screen width / 2.

BR
Jonas




--


Sponsored Links


Other Threads

1. onActivityResult returns RESULT_CANCELED immediately :(

Hi again guys,

I'm trying to launch a sub-activity from my "main" activity and
although the sub-activity does launch (and it's view gets shown), the
parent activity's onActivityResults always gets called back with a
result of RESULT_CANCELED immediately after I call
startActivityForResult (and then the sub-activity gets launched).

Here's the main activity's relevant code:

private void launchSubActivity()
{
    Intent intent = new Intent(this, SubActivityClassName.class);
    startActivityForResult(intent, REQUEST_CODE); // REQUEST_CODE is >= 0

    // Here, I would expect to *not exit* the function *before*
onActivityResult is called (or an activity's lifecycle event triggers)
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode != Activity.RESULT_CANCELED)
        {
                // I never get here because the result is always RESULT_CANCELED
                Toast.makeText(this, "Blah", Toast.LENGTH_SHORT).show();
        }
}

Here's the sub-activity's relevant code (although it's really
irrelevant in this case):

private void handleThisOrThatClick()
{
    setResult(RESULT_CODE); // RESULT_CODE is > Activity.RESULT_CANCELED
    finish();
}

Am I missing something obvious here?
Thanks!

--~--~---------~--~----~------------~-------~--~----~

2. Dalvik spends 7.4% of its time garbage collecting, Android UI spends 7.4% of its time unresponsive

Thanks, cross-posted.






--~--~---------~--~----~------------~-------~--~----~

3. How to pass data when switching between activities in an application

4. Dalvik spends 7.4% of its time garbage collecting, Android UI spends 7.4% of its time unresponsive

5. Dalvik spends 7.4% of its time garbage collecting, Android UI spends 7.4% of its time unresponsive

6. set up a redirection from A:localhost:<localPort> to B:10.0.2.15:<serverPort>

7. How to change view for activities??