{"id":829,"date":"2020-10-28T12:01:54","date_gmt":"2020-10-28T04:01:54","guid":{"rendered":"https:\/\/badgameshow.com\/fly\/?p=829"},"modified":"2020-11-03T14:22:36","modified_gmt":"2020-11-03T06:22:36","slug":"github-%e5%a5%bd%e7%94%a8%e5%88%86%e4%ba%abcropview%e8%a3%81%e5%88%87%e5%9c%96%e7%89%87","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/fly\/github-%e5%a5%bd%e7%94%a8%e5%88%86%e4%ba%abcropview%e8%a3%81%e5%88%87%e5%9c%96%e7%89%87\/","title":{"rendered":"Github \u597d\u7528\u5206\u4eabCropView(\u88c1\u5207\u5716\u7247)"},"content":{"rendered":"<h3>1.\u5148\u5c0e\u5165\u51fd\u793a\u5eab(build.gradle: Project)<\/h3>\n<pre><code class=\"language-Gradle line-numbers\">allprojects {\n    repositories {\n        google()\n        jcenter()\n        maven { url 'https:\/\/jitpack.io' }\n    }\n}\n<\/code><\/pre>\n<h3>2.\u5148\u5c0e\u5165\u51fd\u793a\u5eab(build.gradle: Module)<\/h3>\n<pre><code class=\"language-Gradle line-numbers\">dependencies {\n    implementation 'com.github.wzgl5533:CropView:1.1'\n}\n<\/code><\/pre>\n<h3>3.\u7a0b\u5f0f\u78bc\u7bc4\u4f8b<\/h3>\n<h4>a.Layout(\u906e\u7f69\u8981\u8ddf\u5716\u7247\u5927\u5c0f\u4e00\u6a23)<\/h4>\n<pre><code class=\"language-XML line-numbers\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"#80000000\"\n    tools:context=\".MainActivity\"&gt;\n\n\n    &lt;ImageView\n        android:id=\"@+id\/imageView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:srcCompat=\"@drawable\/dinosaur\" \/&gt;\n\n    &lt;com.qlh.crop.cropviewlibrary.view.CropView\n        android:id=\"@+id\/cropView\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"0dp\"\n        app:cv_crop_model=\"rect  \"\n        app:layout_constraintBottom_toBottomOf=\"@+id\/imageView\"\n        app:layout_constraintEnd_toEndOf=\"@+id\/imageView\"\n        app:layout_constraintStart_toStartOf=\"@+id\/imageView\"\n        app:layout_constraintTop_toTopOf=\"@+id\/imageView\" \/&gt;\n\n    &lt;ImageView\n        android:id=\"@+id\/result\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" \/&gt;\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\n<\/code><\/pre>\n<h4>b.\u8a2d\u5b9a\u8981\u88c1\u5207\u7684\u5716\u7247<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">cropView.setSourceBitmap(BitmapFactory.decodeResource(resources, R.drawable.dinosaur))\n\ncropView.setCropBitmapCallBack {\n     result.setImageBitmap(it)\n}\n<\/code><\/pre>\n<h3>4.\u6548\u679c\u5c55\u793a<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/fly\/wp-content\/uploads\/2020\/10\/video-1603861992.gif\" alt=\"\" \/><\/p>\n<h3>\u4f5c\u8005\u7684Github<\/h3>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/wzgl5533\/CropView\" target=\"_blank\" rel=\"noopener\">CropView<\/a><\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>1.\u5148\u5c0e\u5165\u51fd\u793a\u5eab(build.gradle: Project) allprojects { repositor &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[57],"tags":[130,56,15],"class_list":["post-829","post","type-post","status-publish","format-standard","hentry","category-github","tag-cropview","tag-github","tag-kotlin"],"_links":{"self":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/comments?post=829"}],"version-history":[{"count":13,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/829\/revisions"}],"predecessor-version":[{"id":844,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/829\/revisions\/844"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/media?parent=829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/categories?post=829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/tags?post=829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}