Je sais que c'est une question qui a déjà été posée, mais je pense que je suis en train de faire le bon codage, et pourtant, je n'arrive pas à trouver le bon résultat. Voici mon code xml:LinearLayout non cliquable - Android
<LinearLayout
android:id="@+id/directions_layout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:clickable="true">
<ImageView android:src="@drawable/icon_directions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"/>
<TextView android:text="Directions"
android:textColor="@color/gray"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"/>
</LinearLayout>
Je ne sais pas si cela fait une différence ou non, mais le LinearLayout qui est le parent de celui ne correspond pas cliquable.
Voici où je mets le OnClickListener dans le code:
listener_layout = new OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "hi", Toast.LENGTH_SHORT);
}
};
call_layout = (LinearLayout) findViewById(R.id.call_layout);
call_layout.setOnClickListener(listener_layout);
mais il me ... jamais mis le feu Toutes les suggestions?
wow ... Je me sens stupide. – coder
Oui, parfois les points d'arrêt ressemblent à une approche plus fiable) – inazaruk
@inazaruk: Puis-je +1 000 cela? – kcoppock