Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
What are "arbitrary units" in the javadoc for computeVerticalScrollOffset?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Raffaele Sgarro  
View profile  
 More options Oct 6 2012, 10:49 am
From: Raffaele Sgarro <raffaelesga...@gmail.com>
Date: Sat, 6 Oct 2012 07:49:03 -0700 (PDT)
Local: Sat, Oct 6 2012 10:49 am
Subject: What are "arbitrary units" in the javadoc for computeVerticalScrollOffset?

The documentation for computeVerticalScrollRange() says<http://developer.android.com/reference/android/view/View.html#compute...()>
:

> Compute the vertical range that the vertical scrollbar represents.
> The range is expressed in *arbitrary units* that must be the same as the
> units used by computeVerticalScrollExtent()<http://developer.android.com/reference/android/view/View.html#compute...()>
>  andcomputeVerticalScrollOffset()<http://developer.android.com/reference/android/view/View.html#compute...()>
> .

The same *arbitrary units* are mentioned in the other two methods. Looking
at the sources, this is what I found:

    protected int computeVerticalScrollRange() {
        return getHeight();
    }
    protected int computeVerticalScrollOffset() {
        return mScrollY;
    }
    protected int computeVerticalScrollExtent() {
        return getHeight();
    }

So, what's going on here? getHeight() is documented to return the height of
the view in pixels, and I wander if it makes any sense to measure things in
miles, kilometers, astronomic units... Do they documented it in such a way
to allow subclasses to use percentages or number of items?

In particular, I looked at this methods because I'm implementing a ListView
with a custom background <http://stackoverflow.com/q/12737600/315306>, and
it seems I need to deal with scroll dimensions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Romain Guy  
View profile  
 More options Oct 7 2012, 4:40 am
From: Romain Guy <romain...@android.com>
Date: Sun, 7 Oct 2012 01:37:18 -0700
Local: Sun, Oct 7 2012 4:37 am
Subject: Re: [android-developers] What are "arbitrary units" in the javadoc for computeVerticalScrollOffset?

ListView sometimes uses the "item" unit (total number of items, first
visible item, etc) instead of pixels because it cannot always know the
exact pixel height of all items. You can also use units that come from your
dataset (a map could very well use meters for instance, a graph could use
time or percentage.)

Feel free to use pixels but it's not mandatory. What matters is that all 3
methods use the same unit.
On Oct 6, 2012 7:50 AM, "Raffaele Sgarro" <raffaelesga...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »