0
我有2個TwoWayView在彼此。內部是TWB,外部是TWA。TwoWayView在TwoWayView onItemClick不工作
問題是TWA需要是可點擊的,但是onitemclick函數只能在onitemLongclick事件中運行。
TWA的持有人的xml:
<RelativeLayout
android:layout_width="200dp"
android:layout_height="match_parent"
>
<org.lucasr.twowayview.TwoWayView
android:id="@+id/innerView"
android:focusable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
在TWA的適配器
我嘗試禁用所有可點擊和可聚焦的事情TWB:
viewHolder.innerView.setAdapter(innerListAdapters.get(position));
viewHolder.innerView.setClickable(false);
viewHolder.innerView.setLongClickable(false);
viewHolder.innerView.setFocusable(false);
viewHolder.innerView.setItemsCanFocus(false);
viewHolder.innerView.setOnItemClickListener(null);
viewHolder.innerView.setOnItemLongClickListener(null);
viewHolder.innerView.setOnTouchListener(null);
viewHolder.innerView.setChoiceMode(TwoWayView.ChoiceMode.NONE);
viewHolder.innerView.setFocusableInTouchMode(false);
這是我嘗試設置onItemClick和onItemLongClick到TWA:
friendList.setAdapter(new FriendsAdapter(getActivity(), friends));
friendList.setLongClickable(true);
friendList.setClickable(true);
friendList.setItemMargin(10);
//final FriendsAdapter adapter = (FriendsAdapter) friendList.getAdapter();
friendList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
utils.sendToLog("l " + l + "");
friendListItemClicked(i);
}
});
friendList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
friendListItemLongClicked(i);
return true;
}
});
任何人都可以幫助我嗎?
你有與可聚焦=真試過嗎? – hoomi 2014-08-31 08:52:41
是的,但沒有什麼 – MegaX 2014-08-31 08:56:40
除佈局視圖外,您還有其他任何佈局嗎? – hoomi 2014-08-31 08:59:41