{"id":142,"date":"2023-02-18T20:30:31","date_gmt":"2023-02-18T12:30:31","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=142"},"modified":"2023-02-18T20:31:52","modified_gmt":"2023-02-18T12:31:52","slug":"viewpager-gesture-sliding-disable","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/18\/viewpager-gesture-sliding-disable\/","title":{"rendered":"ViewPager\u624b\u52bf\u6ed1\u52a8\u7981\u7528"},"content":{"rendered":"<p>\u62e6\u622a\u89e6\u6478\u4e8b\u4ef6\u548c\u89e6\u6478\u4e8b\u4ef6\u7684\u8fd4\u56de\u503c\u6539\u4e3afalse\u5373\u53ef<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-java\">public class NoScrollViewPager extends ViewPager {\n    private boolean ENABLE = false;\n\n    public NoScrollViewPager(@NonNull Context context) {\n        super(context);\n    }\n\n    public NoScrollViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    @Override\n    public boolean onInterceptTouchEvent(MotionEvent ev) {\n        return ENABLE &amp;&amp; super.onInterceptTouchEvent(ev);\n    }\n\n    @Override\n    public boolean onTouchEvent(MotionEvent ev) {\n        return ENABLE &amp;&amp; super.onTouchEvent(ev);\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u62e6\u622a\u89e6\u6478\u4e8b\u4ef6\u548c\u89e6\u6478\u4e8b\u4ef6\u7684\u8fd4\u56de\u503c\u6539\u4e3afalse\u5373\u53ef public class NoScrollViewPager [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[68],"class_list":["post-142","post","type-post","status-publish","format-standard","hentry","category-android-basic","tag-viewpager"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}