Re: ImageView setColorFilter, what to do for a bitmap?

by Tim Jones » Sun, 03 Apr 2011 01:54:04 GMT

Sponsored Links
 You can create a new scratch bitmap with a copy of the data and then blt it 
back onto the target bitmap like so:

Paint p = new Paint();

 Canvas c = new Canvas(target);
c.drawBitmap(scratchBitmap, 0, 0, p);


Other Threads

1. How to make LinearLayout smooth scroll ingé”›

hi, i am a new android developer, and recently I was doing a
horizontal scrolling menu. the follow is xml doc:

                android:layout_width="fill_parent" android:scrollbars="none"
                <LinearLayout android:id="@+id/ourlayout"

 class GalleryHorizontalView is defined by myself, it is extends from
in GalleryHorizontalView, I made the following changes  ( changes in
method onTouchEvent(MotionEvent ev) ):

  case MotionEvent.ACTION_MOVE:
                                                // x == ev.getX();
                        final int deltaX = (int) (mLastMotionX - x);
                        mLastMotionX = x;
                                            // i want to let the child
view's ( LinearLayout ) horizontal padding change,so change
                                            //the child view's x
coordinate, x coordinate is change by deltaX;
                        if (deltaX < 0) {
                                if (getScrollX() >= 0) {
                                        getChildAt(0).scrollBy(deltaX, 0);
                        } else if (deltaX > 0) {
                                final int rightEdge = getWidth() - 
                                final int availableToScroll = 
                                                - getScrollX() - rightEdge;
                                if (availableToScroll > 0) {
getChildAt(0).scrollBy(Math.min(availableToScroll, deltaX),

case MotionEvent.ACTION_UP:
                                                int menuItemWidth =
                        int temp = getChildAt(0).getScrollX();
                        int remainder = temp %menuItemWidth;
                        int scrollToCoords = 0;
            // if temp <0 or temp == the child view's  left
coordinate, scrollToCoords =0;
            //scrollToCoords's value is x coordinate when the child
view end its scrolling.
            //the follow calculation is to ensure that each option can
be displayed properly

                        if (temp < 0 || temp == getChildAt(0).getLeft()) {
                                scrollToCoords = 0;
                        } else if (temp >= getChildAt(0).getRight() / 2) {
                                scrollToCoords = getChildAt(0).getWidth() / 2;
                        } else if (temp < getChildAt(0).getRight()
                                        && temp > getChildAt(0).getLeft()) {
                                if (remainder == 0) {
                                        scrollToCoords = temp;
                                } else {
                                        if (remainder > menuItemWidth/2) {
                                                scrollToCoords =
temp - remainder + menuItemWidth;
                                        if (remainder <= menuItemWidth/2) {
                                                scrollToCoords = temp - 
                        float mDeltaX = mLastMotionX - x;
                        mScroller.startScroll((int)mLastMotionX, 0, (int)x, 0, 
                        getChildAt(0).scrollBy((int) mDeltaX, 0);
                        getChildAt(0).scrollTo(scrollToCoords, 0);

i run my app after made this change,the child view LinearLayout can
scroll with the order, but it looks like jump,
not  smooth scrolling, how can make the scroll smooth.

thanks very much.


2. android.os.Build.MANUFACTURER

Is this no longer available?   I find it here:  but
when I try to use eclipse just gives me an error.
The reason I am looking for something like this is to make my unique id
something more substantial.   Since it appears
that android.provider.Settings.Secure.ANDROID_ID cannot be trusted to give
back a 16 digit hex number and the IMEI is probably not on devices without
phone guts I am trying to create my own.   I was going to use the
manufacturer since I would assume that each one would burn a unique
ANDROID_ID into the device but it does not seem to be there anymore.  I
suppose I could use the android.os.Build.PRODUCT if it is going to be around
for successive builds.


Writing code is one of few things
that teaches me I don't know everything.


3. Help! Trying to get Basic Auth working with WebView. setHttpAuthUsernamePassword?

4. listview color

5. icons

6. mapmode

7. Temp storage for bitmap