當前位置: 首頁>>代碼示例>>Java>>正文


Java RecyclerView.getId方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.getId方法的具體用法?Java RecyclerView.getId怎麽用?Java RecyclerView.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.getId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: matchesSafely

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected boolean matchesSafely(final View itemView) {
    resources = itemView.getResources();
    if (childItemView == null) {
        final RecyclerView recyclerView = (RecyclerView) itemView.getRootView().findViewById(recyclerViewId);
        if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
            childItemView = recyclerView.findViewHolderForAdapterPosition(position).itemView;
        } else {
            return false;
        }
    }

    if (targetViewId == -1) {
        return itemView == childItemView;
    } else {
        final View targetView = childItemView.findViewById(targetViewId);
        return itemView == targetView;
    }
}
 
開發者ID:ParaskP7,項目名稱:sample-code-posts,代碼行數:20,代碼來源:RecyclerTypeSafeMatcher.java

示例2: onItemClick

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onItemClick(RecyclerView recycler,View v, int position) {
    switch (recycler.getId()) {
        case R.id.teach_src:
            clickSrc(v,position,true);
            break;
        case R.id.teach_dst:
            clickDst(v,position,false);
            break;
    }
}
 
開發者ID:RockTeach,項目名稱:DynamicTab,代碼行數:12,代碼來源:MainActivity.java

示例3: atPositionOnView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public Matcher<View> atPositionOnView(final int position, final int targetViewId) {

        return new TypeSafeMatcher<View>() {
            Resources resources = null;
            View childView;

            public void describeTo(Description description) {
                String idDescription = Integer.toString(recyclerViewId);
                if (this.resources != null) {
                    try {
                        idDescription = this.resources.getResourceName(recyclerViewId);
                    } catch (Resources.NotFoundException var4) {
                        idDescription = String.format("%s (resource name not found)", recyclerViewId);
                    }
                }

                description.appendText("RecyclerView with id: " + idDescription + " at position: " + position);
            }

            public boolean matchesSafely(View view) {

                this.resources = view.getResources();

                if (childView == null) {
                    RecyclerView recyclerView = view.getRootView().findViewById(recyclerViewId);
                    if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
                        RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(position);
                        if (viewHolder != null) {
                            childView = viewHolder.itemView;
                        }
                    }
                    else {
                        return false;
                    }
                }

                if (targetViewId == -1) {
                    return view == childView;
                } else {
                    View targetView = childView.findViewById(targetViewId);
                    return view == targetView;
                }
            }
        };
    }
 
開發者ID:googlesamples,項目名稱:android-architecture-components,代碼行數:46,代碼來源:RecyclerViewMatcher.java

示例4: atPositionOnView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public Matcher<View> atPositionOnView(final int position, final int targetViewId) {

        return new TypeSafeMatcher<View>() {
            Resources resources = null;
            View childView;

            public void describeTo(Description description) {
                String idDescription = Integer.toString(recyclerViewId);
                if (this.resources != null) {
                    try {
                        idDescription = this.resources.getResourceName(recyclerViewId);
                    } catch (Resources.NotFoundException var4) {
                        idDescription = String.format("%s (resource name not found)", recyclerViewId);
                    }
                }

                description.appendText("RecyclerView with id: " + idDescription + " at position: " + position);
            }

            public boolean matchesSafely(View view) {

                this.resources = view.getResources();

                if (childView == null) {
                    RecyclerView recyclerView =
                            (RecyclerView) view.getRootView().findViewById(recyclerViewId);
                    if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
                        RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(position);
                        if (viewHolder != null) {
                            childView = viewHolder.itemView;
                        }
                    }
                    else {
                        return false;
                    }
                }

                if (targetViewId == -1) {
                    return view == childView;
                } else {
                    View targetView = childView.findViewById(targetViewId);
                    return view == targetView;
                }
            }
        };
    }
 
開發者ID:nareshidiga,項目名稱:Android-CleanArchitecture-Java,代碼行數:47,代碼來源:RecyclerViewMatcher.java

示例5: atPositionOnView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public Matcher<View> atPositionOnView(final int position, final int targetViewId) {

        return new TypeSafeMatcher<View>() {
            Resources resources = null;
            View childView;

            public void describeTo(Description description) {
                String idDescription = Integer.toString(recyclerViewId);
                if (this.resources != null) {
                    try {
                        idDescription = this.resources.getResourceName(recyclerViewId);
                    } catch (Resources.NotFoundException var4) {
                        idDescription = String.format("%s (resource name not found)",
                                recyclerViewId);
                    }
                }

                description.appendText("with id: " + idDescription);
            }

            public boolean matchesSafely(View view) {

                this.resources = view.getResources();

                if (childView == null) {
                    RecyclerView recyclerView = view.getRootView().findViewById(recyclerViewId);
                    if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
                        childView = recyclerView.findViewHolderForAdapterPosition(position).itemView;
                    }
                    else {
                        return false;
                    }
                }

                if (targetViewId == -1) {
                    return view == childView;
                } else {
                    View targetView = childView.findViewById(targetViewId);
                    return view == targetView;
                }

            }
        };
    }
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:45,代碼來源:RecyclerViewMatcher.java

示例6: atPositionOnView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private Matcher<View> atPositionOnView(final int position, final int targetViewId) {

    return new TypeSafeMatcher<View>() {
      Resources resources = null;
      View childView;

      public void describeTo(Description description) {
        String idDescription = Integer.toString(recyclerViewId);
        if (this.resources != null) {
          try {
            idDescription = this.resources.getResourceName(recyclerViewId);
          } catch (Resources.NotFoundException var4) {
            idDescription = String.format("%s (resource name not found)", recyclerViewId);
          }
        }

        description.appendText("with id: " + idDescription);
      }

      public boolean matchesSafely(View view) {

        this.resources = view.getResources();

        if (childView == null) {
          RecyclerView recyclerView = (RecyclerView) view.getRootView().findViewById(recyclerViewId);
          if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
            childView = recyclerView.findViewHolderForAdapterPosition(position).itemView;
          } else {
            return false;
          }
        }

        if (targetViewId == -1) {
          return view == childView;
        } else {
          View targetView = childView.findViewById(targetViewId);
          return view == targetView;
        }
      }
    };
  }
 
開發者ID:mutualmobile,項目名稱:Barricade,代碼行數:42,代碼來源:RecyclerViewMatcher.java

示例7: atPositionOnView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private Matcher<View> atPositionOnView(final int position, final int targetViewId) {
    return new TypeSafeMatcher<View>() {
        Resources resources = null;
        View childView;

        public void describeTo(Description description) {
            String idDescription = Integer.toString(recyclerViewId);
            if (this.resources != null) {
                try {
                    idDescription = this.resources.getResourceName(recyclerViewId);
                } catch (Resources.NotFoundException var4) {
                    idDescription = String.format("%s (resource name not found)", recyclerViewId);
                }
            }

            description.appendText("RecyclerView with id: " + idDescription + " at position: " + position);
        }

        public boolean matchesSafely(View view) {

            this.resources = view.getResources();

            if (childView == null) {
                RecyclerView recyclerView =
                    (RecyclerView) view.getRootView().findViewById(recyclerViewId);
                if (recyclerView != null && recyclerView.getId() == recyclerViewId) {
                    RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(position);
                    if (viewHolder != null) {
                        childView = viewHolder.itemView;
                    }
                } else {
                    return false;
                }
            }

            if (targetViewId == -1) {
                return view == childView;
            } else {
                View targetView = childView.findViewById(targetViewId);
                return view == targetView;
            }
        }
    };
}
 
開發者ID:holidaycheck,項目名稱:RecyclerViewInjectorAdapter,代碼行數:45,代碼來源:RecyclerViewMatcher.java


注:本文中的android.support.v7.widget.RecyclerView.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。