列表按钮android,如何使用列表中的按钮触发Listactivity中的onListItemClick?

小智..

13

我有同样的问题:OnListItemClick没有被解雇![已解决]

这种情况发生在扩展ListActivity的类上,其中ListActivity

的布局将内容TextBox和ListView嵌套到LinearLayout中

,另一个布局用于行(CheckBox和TextBox嵌套到LineraLayout中).

这是代码:

res/layout/configpage.xml(ListActivity的主要内容)

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

android:id="@+id/selection"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="pippo" />

android:id="@android:id/list"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:drawSelectorOnTop="false"

android:background="#aaFFaa" >

res/layout/row.xml (layout for single row)

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:id="@+id/img"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

**android:focusable="false"**

**android:focusableInTouchMode="false"** />

android:id="@+id/testo"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

**android:focusable="false"**

**android:focusableInTouchMode="false"** />

src /.../.../ ConfigPage.java

public class ConfigPage extends ListActivity

{

TextView selection;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.configpage);

// loaded from res/value/strings

String[] azioni = getResources().getStringArray(R.array.ACTIONS);

setListAdapter(new ArrayAdapter<String>(this, R.layout.row,

R.id.testo, azioni));

selection = (TextView) findViewById(R.id.selection);

}

public void onListItemClick(ListView parent, View view, int position, long id)

{

selection.setText(" " + position);

}

}

当我在row.xml上添加时,这开始起作用

android:focusable="false"

android:focusableInTouchMode="false"

我使用Eclipse 3.5.2

Android SDK 10.0.1

min SDK版本:3

我希望这

对我有帮助......对不起我的英语:(

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值