A question on ListView and "Link Clickable" property

by Stanley Cai » Sat, 07 Mar 2009 23:16:35 GMT


Sponsored Links
 Hi,

I have a questions on listview. If I set the text view of items to be
"link clickable" and if the content does include a link, I can not get
OnClickItem event any more in Listview. Did any one meet the same
question? Any suggestion?

Thanks,
-stanley

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



Other Threads

1. Is ProgressBar correctly handling padding-values?

Here is a skeleton of the class I'm currently working on.
Unfortunatly, i'm stuck on two problems and it's driving me mad !

The first problem is about the onKeyDown(KeyEvent) : I don't
understand why this method isn't called while I pressed a key on the
emulator.
The second problem deals with padding. Indeed, I'm always creating
widget using fake paddings in order to be sure my widget correctly
handle those values. Unfortunatly, I tried to extend a ProgressBar and
I had some problems because my ProgressBar is clipped.

My code is :

package com.niji.android.myhouse;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.ProgressBar;

public class ProgressWheel extends ProgressBar {

        private static final String TAG_LOG = "ProgressWheel";
        private static final Paint mPaint = new Paint();

        private float oldX;

        public ProgressWheel(Context context, AttributeSet attrs) {
                this(context, attrs, 0);
        }

        public ProgressWheel(Context context, AttributeSet attrs, int
defStyle) {
                super(context, attrs, defStyle);

                mPaint.setStrokeWidth(1.0f);
                mPaint.setColor(Color.MAGENTA);
                mPaint.setStyle(Paint.Style.STROKE);

                setPadding(5, 15, 40, 10)

        }

        @Override
        protected synchronized void onDraw(Canvas canvas) {
                /*
                 * I'm not sure the onDraw(Canvas) method from ProgressBar is
correctly
                 * implemented. Indeed. With padding values, The progressBar 
may be
"clipped"
                 */
                super.onDraw(canvas);
                canvas.drawRect(0, 0, getWidth()-1, getHeight()-1, mPaint);
        }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
                /*
                 * I don't understand why this method is not called
                 */
        int progress = getProgress();
        Log.d(TAG_LOG, "onKeyDown");
        switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                Log.d(TAG_LOG, "KEYCODE_DPAD_LEFT");
                if (progress <= 0) break;
                setProgress(progress - 1);
                return true;

            case KeyEvent.KEYCODE_DPAD_RIGHT:
                Log.d(TAG_LOG, "KEYCODE_DPAD_RIGHT");
                if (progress >= getMax()) break;
                setProgress(progress + 1);
                return true;
        }

        return super.onKeyDown(keyCode, event);
    }

        @Override
        public boolean onTouchEvent(MotionEvent event) {
                Log.d(TAG_LOG, "onTouchEvent");
                int progress = getProgress();

                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                        oldX = event.getX();
                        break;
                case MotionEvent.ACTION_MOVE:
                        if (event.getX() > oldX) {
                                setProgress(progress + 1);
                        }
                        else setProgress(progress - 1);
                        oldX = event.getX();
                        break;

                default:
                        break;
                }

                return true;
        }



}

and here is my XML layout :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
        android:id="@+id/RelativeLayout01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        xmlns:android="http://schemas.android.com/apk/res/android" >

        <com.mypackage.ProgressWheel
            style="?android:attr/progressBarStyleHorizontal"
                android:layout_centerInParent="true"
                android:layout_margin="10px"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:progress="35" />

</RelativeLayout>


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

2. Android Market: server error when "authorizing credit card"

Are you trying to purchase your own app? I got the same error when I
did, but not when I purchased someone else's.



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

3. HTML login form works in Android browser and fails with WebView ?

4. Better JavaScript debugging for a WebView

5. Timeframe for adding SensorEventListener class to released SDK

6. Confused about 9-patch files

7. Hoping to change widget attributes by selecting a menu item