1
내 RecyclerVIew는 RecyclerView에서 CardView 클릭 할 수 없습니다
내 활동 컨테이너 :
내 조각 :
<android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar/>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?actionBarSize"
android:clipToPadding="false"
android:paddingBottom="8dp"
android:paddingLeft="8dp" />
내 CardView :
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:cardCornerRadius="2dp"
app:cardElevation="2dp">
...
</android.support.v7.widget.CardView>
OnClickListener를 :
holder.card.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Log.d("click","click");
}
});
cardview가 클릭 할 수없는 이유는 무엇입니까? 내가 뭘 잘못 했니?
문제가'CardView' 자체입니까? 다른보기 (예 :'FrameLayout')가 있으면 작동합니까? –
onClickListener를 올바르게 설정 하시겠습니까? –
holder.card.setOnClickListener (새 View.OnClickListener() { @Override 공공 무효 온 클릭 (보기 V) { Log.d (,) "클릭" "클릭", 을} }); – gape