1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

onClick in TextView doesnt work


Last Updated:

  1. Markus Taubek

    Markus Taubek Member This Topic's Starter

    Joined:
    Nov 3, 2010
    Messages:
    12
    Likes Received:
    0
    Hello,

    I want a Menu with Textview to click it and react.

    There is my TextView:
    Code (Text):
    1. <TextView
    2.                 android:layout_width="fill_parent"
    3.                 android:layout_height="40px"
    4.                 android:text="MyLink"
    5.                 android:onClick="onClickMyLink"
    6.                 android:textColor="@color/white"
    7.                 android:padding="8px"
    8.                 style="@style/home_menu"/>
    There is my listener method:
    Code (Text):
    1. public void onClickMyLink(final View sfNormal) {
    But If I click on the Text, it is not call my method.
    The same method is working with a <button> tag
    but not with my TextView.

    Anybody an idea?

    greets
    Markus
     

    Advertisement
  2. droidotheplains

    droidotheplains Member

    Joined:
    Nov 11, 2010
    Messages:
    15
    Likes Received:
    1
  3. aguywithathing

    aguywithathing Member

    Joined:
    Oct 12, 2010
    Messages:
    18
    Likes Received:
    5
    two things:

    1. Clickable views should come with an ID to identify them

    2. It's not clickable without android:clickable="true"
     
  4. Markus Taubek

    Markus Taubek Member This Topic's Starter

    Joined:
    Nov 3, 2010
    Messages:
    12
    Likes Received:
    0
    Thanks.. android:clickable is the attribut what I searched.

    greets
    Markus
     

Share This Page

Loading...