我有一個非常複雜的listView在我的應用程序,可以啓動基於每個rowView的一些標誌不同的活動(一些rowView甚至不能啓用點擊)。如何動畫ListView內的rowView是一個OnClickListener已被應用到該視圖
我選擇在每個rowView上添加一個OnClickListener來啓動活動,但是在我將監聽器添加到rowView之後,當它點擊時它不再動畫(它應該變暗,就像默認的android實現)。 沒有監聽器的RowView仍然動畫,所以我想我錯過了一些調用,使它變得更黑。
任何提示?
編輯:由於我被要求一些代碼,這裏是我的customAdapter的getView
public View getView(final int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.customlistitem, null, true);
if (infoList.get(position).isSeparator()){
// Populate the view and don't add a listener
} else {
// Populate the view in some other way and add a listener
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, myActivity.class);
intent.putExtra("an_extra", new Object());
intent.putExtra("another_extra", new Object());
intent.putExtra("a_third_extra", new Object());
context.startActivity(intent);
}
});
}
return rowView;
}
如果對象具有標誌並將isSeparator之成爲當我點擊變暗,否則它不會簡化管理單元。
請張貼一些代碼 – AndroidEnthusiast 2014-10-03 13:29:44