Java android listview按钮控件
我有一个安卓列表视图,里面有很多项目 每个项目都有一个按钮 这是MyListView的模板Java android listview按钮控件,java,android,android-widget,Java,Android,Android Widget,我有一个安卓列表视图,里面有很多项目 每个项目都有一个按钮 这是MyListView的模板 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingBottom="6dip" android:layout_width="wrap_content" android:layout_height="wrap_con
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingBottom="6dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingTop="5px"
android:paddingRight="5px"
android:gravity="left">
<TextView android:id="@+id/TextView_test1"
android:layout_width="200dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/TextView_test2"
android:layout_width="250dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/TextView_test3"
android:layout_width="400dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/Button_buttontest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Button_buttontest"/>
</LinearLayout>
我如何处理活动代码中每个按钮的点击?
每个按钮都有相同的id“button\u buttontest”
提前谢谢。
顺致敬意,
Jose您可能需要创建一个自定义的
适配器
,用于在创建行的视图时将视图连接到按钮。OnClickListener
。由于您是从视图中创建OnClickListener,因此您将知道单击的行的位置。也许有更好的办法,但这是我想到的第一件事