Note the the line:

copyTo.setClickable(false)

was something I had inserted while testing.  Taking it out still makes
the code exhibit the same behavior.

Nik

On Dec 9, 8:57 pm, Nik Bhattacharya <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I have the following situation.  I have a LinearLayout that has an
> onclick listener on it.  In the linear layout, I have a TextView that
> has some text in it.  I use Linkify on the TextView with the following
> intention:
>
> If there is a linkable item (I used Linkify.ALL) on the TextView, I
> would like that portion of the TextView to become clickable.  I would
> like any other clicks within either the TextView or outside of it to
> be handled by the parent linear layouts on click listener.
>
> I am noticing that the TextView eats the click event whether there are
> links or not.  I am also noticing that when the TextView ends with the
> link (for example, lets say the text is "I like this urlwww.someurl.com"),
> then the text "I like this url" is not clickable, however, the rest of
> the entire TextView is clickable, including the "www.someurl.com" as
> well as anything outside it (which is undesirable behavior for me).
> If I add some text such as "I like this urlwww.someurl.comvery
> much", then I notice that the "I like this url" and the "very much"
> are not clickable, but if the link or anything in the same x
> coordinate but no matter what the y coordinate all links to the
> "www.someurl.com".
>
> I would really like my TextView to really act like a transparent label
> that possibly has a hotspot.  If it does not, then it should not
> interfere with the bubbling of events.
>
> I have included my sample code for you to see exactly what I am
> talking about.  Can somebody offer me a suggestion to enable me to
> achieve my desired behavior?
>
> Much appreciated,
>
> Nik
>
> --------------------
> main.xml
> --------------------
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>         android:orientation="vertical" android:layout_width="fill_parent"
>         android:layout_height="fill_parent">
>         <EditText android:id="@+id/copyFrom"
> android:layout_width="fill_parent"
>                 android:layout_height="wrap_content" android:hint="Enter text 
> here"
>                 android:lines="4" />
>         />
>         <Button android:id="@+id/button" android:layout_width="fill_parent"
>                 android:layout_height="wrap_content" android:text="Copy" />
>         />
>         <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                 android:id="@+id/addListenerHere" 
> android:orientation="vertical"
>                 android:layout_width="fill_parent"
> android:layout_height="fill_parent"
>                 android:layout_weight="1" android:background="#FFFFFFFF">
>                 <TextView android:id="@+id/copyTo"
> android:layout_width="fill_parent"
>                         android:layout_height="wrap_content" android:text=""
>                         android:background="#FF000232" android:lines="10"
>                         android:autoLink="all"
>                         android:layout_margin="20dp" />
>         </LinearLayout>
> </LinearLayout>
>
> -----------------
> LinkifyTextViewActivity.java
> ------------------
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
> import android.widget.TextView;
> import android.widget.Toast;
>
> public class LinkifyTextViewActivity extends Activity {
>
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         final EditText copyFrom = (EditText) findViewById
> (R.id.copyFrom);
>         final TextView copyTo = (TextView) findViewById(R.id.copyTo);
>
>         Button button = (Button) findViewById(R.id.button);
>         button.setOnClickListener(new View.OnClickListener()
>         {
>
>             @Override
>             public void onClick(View view)
>             {
>                 copyTo.setText(copyFrom.getText().toString());
>                 copyTo.setClickable(false);
>             }
>
>         });
>
>         View viewToListenTo = findViewById(R.id.addListenerHere);
>         viewToListenTo.setOnClickListener(new View.OnClickListener()
>         {
>
>             @Override
>             public void onClick(View view)
>             {
>                 Toast makeText = Toast.makeText
> (LinkifyTextViewActivity.this, "Clicked the parent", 200);
>                 makeText.show();
>             }
>
>         });
>     }
>
> }
>
>
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to