{"id":13552,"date":"2023-12-27T09:37:31","date_gmt":"2023-12-27T01:37:31","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=13552"},"modified":"2023-12-27T09:37:31","modified_gmt":"2023-12-27T01:37:31","slug":"app%e5%bc%80%e5%8f%91%e4%b8%80%e5%a5%97%e4%bb%a3%e7%a0%81%e8%a6%81%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/12\/27\/app%e5%bc%80%e5%8f%91%e4%b8%80%e5%a5%97%e4%bb%a3%e7%a0%81%e8%a6%81%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%9f\/","title":{"rendered":"app\u5f00\u53d1\u4e00\u5957\u4ee3\u7801\u8981\u600e\u4e48\u505a\uff1f"},"content":{"rendered":"

APP\u5f00\u53d1\u662f\u4e00\u4e2a\u5e7f\u6cdb\u7684\u9886\u57df\uff0c\u6d89\u53ca\u5230\u591a\u79cd\u6280\u672f\u548c\u7f16\u7a0b\u8bed\u8a00\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u4f60\u4ecb\u7ecd\u4e00\u5957\u5f00\u53d1APP\u7684\u4ee3\u7801\uff0c\u5305\u62ec\u5176\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n

\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u660e\u786eAPP\u5f00\u53d1\u7684\u57fa\u672c\u6982\u5ff5\u3002APP\u662f\u6307\u5e94\u7528\u7a0b\u5e8f\uff0c\u662f\u4e00\u79cd\u53ef\u4ee5\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u8fd0\u884c\u7684\u8f6f\u4ef6\u3002\u5f00\u53d1APP\u9700\u8981\u4f7f\u7528\u7279\u5b9a\u7684\u7f16\u7a0b\u8bed\u8a00\u548c\u5f00\u53d1\u5de5\u5177\u3002\u76ee\u524d\uff0c\u6700\u5e38\u7528\u7684\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u5e73\u53f0\u662fAndroid\u548ciOS\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u5c06\u4ecb\u7ecd\u4e00\u5957\u9002\u7528\u4e8eAndroid\u5e73\u53f0\u7684APP\u5f00\u53d1\u4ee3\u7801\u3002<\/p>\n

Android\u5e73\u53f0\u4f7f\u7528Java\u8bed\u8a00\u8fdb\u884c\u5f00\u53d1\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u5177\u5907\u4e00\u5b9a\u7684Java\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u662f\u4e00\u5957\u7b80\u5355\u7684APP\u5f00\u53d1\u4ee3\u7801\uff1a<\/p>\n

“`java<\/p>\n

\/\/ MainActivity.java<\/p>\n

import android.app.Activity;<\/p>\n

import android.os.Bundle;<\/p>\n

import android.widget.TextView;<\/p>\n

public class MainActivity extends Activity {<\/p>\n

@Override<\/p>\n

protected void onCreate(Bundle savedInstanceState) {<\/p>\n

super.onCreate(savedInstanceState);<\/p>\n

\/\/ \u8bbe\u7f6e\u5e03\u5c40\u6587\u4ef6<\/p>\n

setContentView(R.layout.activity_main);<\/p>\n

\/\/ \u83b7\u53d6TextView\u63a7\u4ef6<\/p>\n

TextView textView = (TextView) findViewById(R.id.text_view)APP<\/a>;<\/p>\n

\/\/ \u8bbe\u7f6e\u6587\u672c\u5185\u5bb9<\/p>\n

textView.setText(“Hello, World!”);<\/p>\n

}<\/p>\n

}<\/p>\n

“`<\/p>\n

\u4e0a\u9762\u7684\u4ee3\u7801\u662f\u4e00\u4e2a\u7b80\u5355\u7684Android\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u6587\u4ef6MainActivity.java\u3002\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u7ee7\u627f\u4e86Activity\u7c7b\uff0c\u5e76\u91cd\u5199\u4e86onCreate()\u65b9\u6cd5\u3002\u5728onCreate()\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u8fdb\u884c\u4e86\u4e00\u4e9b\u521d\u59cb\u5316\u5de5\u4f5c\uff0c\u5305\u62ec\u8bbe\u7f6e\u5e03\u5c40\u6587\u4ef6\u548c\u8bbe\u7f6e\u6587\u672c\u5185\u5bb9\u3002<\/p>\n

\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u5e03\u5c40\u6587\u4ef6activity_main.xml\uff0c\u7528\u4e8e\u5b9a\u4e49APP\u7684\u754c\u9762\u5e03\u5c40\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5e03\u5c40\u6587\u4ef6\u793a\u4f8b\uff1a<\/p>\n

“`xml<\/p>\n

<\/p>\n<\/p>\n

xmlns:tools=”http:\/\/schemas.android.com\/tools”<\/p>\n

android:layout_width=”match_parent”<\/p>\n

android:layout_height=”match_parent”<\/p>\n

android:orientation=”vertical”<\/p>\n

android:gravity=”center”><\/p>\n<\/p>\n

android:id=”@+id\/text_view”<\/p>\n

android:layout_width=”wrap_content”<\/p>\n

android:layout_height=”wrap_content”<\/p>\n

android:textSize=”24sp”<\/p>\n

android:textColor=”#000000″ \/><\/p>\n

“`<\/p>\n

\u4e0a\u9762\u7684\u4ee3\u7801\u4f7f\u7528LinearLayout\u4f5c\u4e3a\u6839\u5e03\u5c40\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e2aTextView\u63a7\u4ef6\u7528\u4e8e\u663e\u793a\u6587\u672c\u5185\u5bb9<\/p>\n

<\/figure>\n<\/p>\n

\u3002<\/p>\n

\u9664\u4e86\u4e0a\u8ff0\u4ee3\u7801\u5916\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\uff0c\u4f8b\u5982\u58f0\u660eAPP\u7684\u5165\u53e3Activity\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684AndroidManifest.xml\u6587\u4ef6\u793a\u4f8b\uff1a<\/p>\n

“`xml<\/p>\n

<\/p>\n<\/p>\n

package=”com.example.app”><\/p>\n<\/p>\n

android:allowBackup=”true”<\/p>\n

android:icon=”@drawable\/ic_launcher”<\/p>\n

android:label=”@string\/app_name”<\/p>\n

android:theme=”@style\/AppTheme”><\/p>\n<\/p>\n

android:name=”.MainActivity”<\/p>\n

android:label=”@string\/app_name”<\/p>\n

android:theme=”@style\/AppTheme.NoActionBar”><\/p>\n

\n<\/p>\n<\/p>\n

“`<\/p>\n

\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u58f0\u660e\u4e86APP\u7684\u5305\u540d\u3001\u5165\u53e3Activity\u7b49\u4fe1\u606f\u3002<\/p>\n

\u7efc\u4e0a\u6240\u8ff0\uff0c\u8fd9\u5957\u4ee3\u7801\u5b9e\u73b0\u4e86\u4e00\u4e2a\u7b80\u5355\u7684Android\u5e94\u7528\u7a0b\u5e8f\uff0c\u5305\u62ec\u4e00\u4e2a\u5165\u53e3Activity\u548c\u4e00\u4e2a\u663e\u793a\u6587\u672c\u7684TextView\u63a7\u4ef6\u3002\u901a\u8fc7\u8fd9\u5957\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u5230APP\u5f00\u53d1\u7684\u57fa\u672c\u539f\u7406\u548c\u6d41\u7a0b\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Java\u8bed\u8a00\u548cAndroid\u5f00\u53d1\u5de5\u5177\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n

\u5f53\u7136\uff0c\u8fd9\u53ea\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u771f\u6b63\u7684APP\u5f00\u53d1\u9700\u8981\u66f4\u591a\u7684\u4ee3\u7801\u548c\u529f\u80fd\u5b9e\u73b0\u3002\u5982\u679c\u4f60\u5bf9APP\u5f00\u53d1\u611f\u5174\u8da3\uff0c\u5efa\u8bae\u4f60\u6df1\u5165\u5b66\u4e60Java\u7f16\u7a0b\u8bed\u8a00\u3001AndroiAPP\u5f00\u53d1<\/a>d\u5f00\u53d1\u6846\u67b6\u548c\u76f8\u5173\u5de5\u5177\uff0c\u4ee5\u53ca\u638c\u63e1\u66f4\u591a\u7684APP\u5f00\u53d1\u6280\u5de7\u548c\u77e5\u8bc6\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

APP\u5f00\u53d1\u662f\u4e00\u4e2a\u5e7f\u6cdb\u7684\u9886\u57df\uff0c\u6d89\u53ca\u5230\u591a\u79cd\u6280\u672f\u548c\u7f16\u7a0b\u8bed\u8a00\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u4f60\u4ecb\u7ecd\u4e00\u5957\u5f00\u53d1APP\u7684\u4ee3\u7801\uff0c\u5305\u62ec\u5176\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u660e\u786eAPP\u5f00\u53d1\u7684\u57fa\u672c\u6982\u5ff5\u3002APP\u662f\u6307\u5e94\u7528\u7a0b\u5e8f\uff0c\u662f\u4e00\u79cd\u53ef\u4ee5\u5728\u79fb<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[38,15747,7375,12,849],"topic":[],"class_list":["post-13552","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-38","tag-windows","tag-exe","tag-12","tag-849"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=13552"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13552\/revisions"}],"predecessor-version":[{"id":13699,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/13552\/revisions\/13699"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=13552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=13552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=13552"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=13552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}