У меня есть xml
, что handle onclick
в xml
onClick of Button
работает, но onClick TextView
не работает.Не работает onClick xml? Android
пыльника Моего row_listview.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ffffff"
android:gravity="center"
android:orientation="horizontal" >
<HorizontalScrollView
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbars="none" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/row_cell_text_dummy_multilevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:singleLine="false"
android:textColor="#ffffff"
android:textSize="10dp" />
<Button
android:id="@+id/row_cell_btn_multilevel"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:onClick="CellButtonClick" />
<TextView
android:id="@+id/row_cell_text_multilevel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:gravity="center|left"
android:clickable="true"
android:onClick="CellTextClick"
android:singleLine="true"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
И ниже является моим StartActivity.class
:
public class StartActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
}
public void CellTextClick(View v){
try {
Log.i("test", "OK");
} catch (Exception e) {
}
}
}
Примечания: моя android:onClick="CellButtonClick"
работы хорошим, но мой android:onClick="CellTextClick"
не работает.
я добавил, но не работают. –
@ A.A Странно, это прекрасно работает в моем случае. –
мой андроид: onClick = "CellButtonClick" работает хорошо, но мой андроид: onClick = "CellTextClick" не работает. –