{"id":167,"date":"2023-05-18T12:05:31","date_gmt":"2023-05-18T04:05:31","guid":{"rendered":"https:\/\/app.60day.cn\/appday\/?p=167"},"modified":"2023-05-18T12:05:31","modified_gmt":"2023-05-18T04:05:31","slug":"android-floatbutton%e6%98%af%e4%bb%80%e4%b9%88%e6%84%8f%e6%80%9d%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/app.60day.cn\/appday\/kaifaapp\/167\/","title":{"rendered":"android floatbutton\u662f\u4ec0\u4e48\u610f\u601d\u5462\uff1f"},"content":{"rendered":"<p>Android FloatButton\uff0c\u5373\u60ac\u6d6e\u6309\u94ae\uff0c\u662f\u4e00\u79cd\u5e38\u89c1\u7684UI\u8bbe\u8ba1\u5143\u7d20\uff0c\u5b83\u53ef\u4ee5\u5728\u5e94\u7528\u7684\u754c\u9762\u4e2d\u6d6e\u52a8\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e9b\u5e38\u7528\u7684\u64cd\u4f5c\u3002FloatButton\u7684\u51fa\u73b0\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u589e\u52a0\u5e94\u7528\u7684\u7f8e\u89c2\u5ea6\uff0c\u8fd8\u53ef\u4ee5\u63d0\u9ad8\u7528\u6237\u7684\u4f7f\u7528\u6548\u7387\u3002\u672c\u6587\u5c06\u4ece\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u4e24\u4e2a\u65b9\u9762\uff0c\u6765\u4ecb\u7ecdAndroid FloatButton\u7684\u76f8\u5173\u5185\u5bb9\u3002<\/p>\n<p>\u4e00\u3001\u539f\u7406<\/p>\n<p>Android FloatButton\u7684\u5b9e\u73b0\u539f\u7406\uff0c\u5176\u5b9e\u5c31\u662f\u901a\u8fc7\u5728\u5e03\u5c40\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u6d6e\u52a8\u7684\u6309\u94ae\uff0c\u5e76\u4e14\u8bbe\u7f6e\u5176\u5728\u5c4f\u5e55\u4e0a\u7684\u4f4d\u7f6e\u3001\u5927\u5c0f\u548c\u56fe\u6807\u7b49\u5c5e\u6027\uff0c\u4ece\u800c\u5b9e\u73b0\u5728\u5e94\u7528\u7684\u754c\u9762\u4e2d\u6d6e\u52a8\u7684\u6548\u679c\u3002\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801\u7f16\u5199\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u5728\u4ee3\u7801\u7f16\u5199\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728\u5e03\u5c40\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2aFloatingActionButton\u7684\u63a7\u4ef6\uff0c\u7136\u540e\u5728Java\u4ee3\u7801\u4e2d\u5bf9\u5176\u8fdb\u884c\u8bbe\u7f6e\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`xml<\/p>\n<\/p>\n<p>    android:id=&#8221;@+id\/fab&#8221;<\/p>\n<p>    android:layout_width=&#8221;wrap_content&#8221;<\/p>\n<p>    android:layout_height=&#8221;wrap_content&#8221;<\/p>\n<p>    android:layout_gravity=&#8221;bottom|end&#8221;<\/p>\n<p>    android:layout_margin=&#8221;@dimen\/fab_margin&#8221;<\/p>\n<p>    android:src=&#8221;@drawable\/ic_add&#8221;<\/p>\n<p>    app:backgroundTint=&#8221;@color\/colorAccent&#8221;<\/p>\n<p>    app:elevation=&#8221;6dp&#8221;<\/p>\n<p>    app:pressedTranslationZ=&#8221;12dp&#8221; \/&gt;<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728Java\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u83b7\u53d6\u8be5\u63a7\u4ef6\u7684\u5b9e\u4f8b\uff0c\u6765\u5bf9\u5176\u8fdb\u884c\u4e00\u4e9b\u5c5e\u6027\u7684\u8bbe\u7f6e\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`java<\/p>\n<p>FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);<\/p>\n<p>fab.setOnClickListener(new View.OnClickListener() {<\/p>\n<p>    @Override<\/p>\n<p>    public void onClick(View view) {<\/p>\n<p>        \/\/ TODO: Perform action on click<\/p>\n<p>    }<\/p>\n<p>});<\/p>\n<p>&#8220;`<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6765\u5b9e\u73b0FloatButton\u7684\u6548\u679c\uff0c\u5176\u4e2d\u6bd4\u8f83\u53d7\u6b22\u8fce\u7684\u662fAndroid Floating Action Button\u548cM<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/15\/27053424814.jpg\" \/><\/figure>\n<\/p>\n<p>aterial Design Library\u7b49\u5e93\u3002<\/p>\n<p>\u4e8c\u3001\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>Android Floa<a href=\"https:\/\/www.yimenapp.net\/dabao-459.html\">ios Associated Domains<\/a>tButton\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u4e3b\u8981\u5305\u62ec\u5176\u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f\u3001\u5b9e\u73b0\u65b9\u5f0f\u548c\u6ce8\u610f\u4e8b\u9879\u7b49\u65b9\u9762\u3002<\/p>\n<p>1. \u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f<\/p>\n<p>FloatButton\u7684\u5e38\u89c1\u4f7f\u7528\u573a\u666f\uff0c\u4e3b\u8981\u662f\u5728\u5e94\u7528\u7684\u4e3b\u754c\u9762\u6216\u8005\u662f\u67d0\u4e2a\u529f\u80fd\u6a21\u5757\u4e2d\uff0c\u7528\u6765\u63d0\u4f9b\u4e00\u4e9b\u5e38\u7528\u7684\u64cd\u4f5c\uff0c\u5982\u65b0\u589e\u3001\u7f16\u8f91\u3001\u5206\u4eab\u3001\u8fd4\u56de\u7b49\u7b49\u3002\u540c\u65f6\uff0c\u5728\u8bbe\u8ba1FloatButton\u65f6\uff0c\u8fd8\u8981\u8003\u8651\u5176\u5728\u5e94\u7528\u4e2d\u7684\u4f4d\u7f6e\u548c\u5927\u5c0f\u7b49\u56e0\u7d20\uff0c\u4ee5\u786e\u4fdd\u5176\u4e0d\u4f1a\u5f71\u54cd\u5230\u7528\u6237\u7684\u4f7f\u7528\u548c\u4f53\u9a8c\u3002<\/p>\n<p>2. \u5b9e\u73b0\u65b9\u5f0f<\/p>\n<p>Floa<a href=\"https:\/\/www.yimenapp.net\/dabao-2856.html\">ios\u4e91\u6253\u5305<\/a>tButton\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u4e3b\u8981\u6709\u4e24\u79cd\uff0c\u4e00\u79cd\u662f\u901a\u8fc7\u4ee3\u7801\u7f16\u5199\u7684\u65b9\u5f0f\uff0c\u53e6\u4e00\u79cd\u662f\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7684\u65b9\u5f0f\u3002<\/p>\n<p>\u5728\u4f7f\u7528\u4ee3\u7801\u7f16\u5199\u7684\u65b9\u5f0f\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5728\u5e03\u5c40\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2aFloatingActionButton\u63a7\u4ef6\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u5c5e\u6027\u8bbe\u7f6e\u548c\u4e8b\u4ef6\u76d1\u542c\u7b49\u64cd\u4f5c\u3002<\/p>\n<p>\u5728\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7684\u65b9\u5f0f\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Android Floating Action Button\u6216\u8005Material Design Library\u7b49\u5e93\uff0c\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e9b\u9884\u5b9a\u4e49\u7684\u6837\u5f0f\u548c\u5c5e\u6027\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u66f4\u52a0\u65b9\u4fbf\u5730\u5b9e\u73b0FloatButton\u7684\u6548\u679c\u3002<\/p>\n<p>3. \u6ce8\u610f\u4e8b\u9879<\/p>\n<p>\u5728\u8bbe\u8ba1\u548c\u4f7f\u7528FloatButton\u65f6\uff0c\u8fd8\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<p>\uff081\uff09FloatButton\u7684\u4f4d\u7f6e\u548c\u5927\u5c0f\u5e94\u8be5\u8003\u8651\u5230\u7528\u6237\u7684\u4f7f\u7528\u548c\u4f53\u9a8c\uff0c\u4e0d\u5e94\u8be5\u5f71\u54cd\u5230\u7528\u6237\u7684\u64cd\u4f5c\u3002<\/p>\n<p>\uff082\uff09FloatButton\u7684\u56fe\u6807\u5e94\u8be5\u6e05\u6670\u660e\u4e86\uff0c\u7b26\u5408\u7528\u6237\u7684\u4f7f\u7528\u4e60\u60ef\u3002<\/p>\n<p>\uff083\uff09FloatButton\u7684\u70b9\u51fb\u4e8b\u4ef6\u5e94\u8be5\u4e0e\u5e94\u7528\u7684\u529f\u80fd\u76f8\u5173\uff0c\u5e76\u4e14\u64cd\u4f5c\u7b80\u5355\u660e\u4e86\u3002<\/p>\n<p>\uff084\uff09FloatButton\u7684\u6837\u5f0f\u548c\u989c\u8272\u5e94\u8be5\u4e0e\u5e94\u7528\u7684\u6574\u4f53\u98ce\u683c\u4e00\u81f4\uff0c\u4ee5\u589e\u5f3a\u5e94\u7528\u7684\u7f8e\u89c2\u5ea6\u3002<\/p>\n<p>\u7efc\u4e0a\u6240\u8ff0\uff0cAndroid FloatButton\u4f5c\u4e3a\u4e00\u79cd\u5e38\u89c1\u7684UI\u8bbe\u8ba1\u5143\u7d20\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u9ad8\u5e94\u7528\u7684\u7f8e\u89c2\u5ea6\uff0c\u8fd8\u53ef\u4ee5\u63d0\u9ad8\u7528\u6237\u7684\u4f7f\u7528\u6548\u7387\u3002\u5728\u4f7f\u7528FloatButton\u65f6\uff0c\u6211\u4eec\u9700\u8981\u8003\u8651\u5230\u5176\u5b9e\u73b0\u65b9\u5f0f\u3001\u4f7f\u7528\u573a\u666f\u548c\u6ce8\u610f\u4e8b\u9879\u7b49\u65b9\u9762\uff0c\u4ee5\u786e\u4fdd\u5176\u5728\u5e94\u7528\u4e2d\u7684\u4f7f\u7528\u6548\u679c\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android FloatButton\uff0c\u5373\u60ac\u6d6e\u6309\u94ae\uff0c\u662f\u4e00\u79cd\u5e38\u89c1\u7684UI\u8bbe\u8ba1\u5143\u7d20\uff0c\u5b83\u53ef\u4ee5\u5728\u5e94\u7528\u7684\u754c\u9762\u4e2d\u6d6e\u52a8\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e9b\u5e38\u7528\u7684\u64cd\u4f5c\u3002FloatButton\u7684\u51fa\u73b0\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u589e\u52a0\u5e94\u7528\u7684\u7f8e\u89c2\u5ea6\uff0c\u8fd8\u53ef\u4ee5\u63d0\u9ad8\u7528\u6237\u7684<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[422,298,353,44,421],"topic":[],"class_list":["post-167","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-apktool","tag-298","tag-353","tag-44","tag-apkapp"],"_links":{"self":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/comments?post=167"}],"version-history":[{"count":0,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/167\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/media?parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/categories?post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/tags?post=167"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/topic?post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}