[實作講解] Random number
Step #1
一樣先反編譯
打開 AndroidManifest.xml 檢查一下權限和配置
<?xml version="1.0"encoding="utf-8"standalone="no"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"package="hagedorn.bastian.zufall"> <application android:allowBackup="true"android:icon="@drawable/ic_launcher2"android:label="@string/app_name"android:theme="@style/AppTheme"> <activity android:label="@string/app_name"android:name="hagedorn.bastian.zufall.MainActivity"android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest>
基本上沒什麼問題
沒權限也沒廣告
Step #2
進到 res 裡面
可以看到
沒有繁中語系
所以自己創一個
zh 是中文語系的意思
代表只要手機語言是中文 (不論是簡 or 繁)
都會優先執行這個資料夾裡面的東西
Step #3
接下來進到 values 裡面
判斷字應該都在 strings.xml 裡面
打開檢查一下
<?xml version="1.0"encoding="utf-8"?> <resources> <string name="app_name">Random Number</string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string> <string name="equal_less"><= X <=</string> <string name="X">X</string> <string name="one">1</string> <string name="six">6</string> <string name="usage">touch to start</string> <string name="maximum">maximum</string> <string name="minimum">minimum</string> <string name="settings">Settings</string> <string name="dice_image_view_description">show dice if chance is within one and six</string> <string name="setting_button_description">Button to access the settings</string> <string name="save_image_button_description">saves the settings</string> <string name="cancel_image_button_description">discards the settings</string> <string name="title_activity_settings">SettingsActivity</string> <string name="settings_button_save">save</string> <string name="settings_button_cancel">cancel</string> </resources>
100% 確定了
(因為這套字超少, 有什麼字我都記起來了)
Step #3
複製一份 strings.xml 到剛剛建立的資料夾裡面
Step #4
打開, 開始翻譯
<?xml version="1.0"encoding="utf-8"?> <resources> <string name="app_name"> 隨機數字 </string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string> <string name="equal_less"><= X <=</string> <string name="X">X</string> <string name="one">1</string> <string name="six">6</string> <string name="usage"> 點擊開始 </string> <string name="maximum"> 最大值 </string> <string name="minimum"> 最小值 </string> <string name="settings">Settings</string> <string name="dice_image_view_description">show dice if chance is within one and six</string> <string name="setting_button_description">Button to access the settings</string> <string name="save_image_button_description">saves the settings</string> <string name="cancel_image_button_description">discards the settings</string> <string name="title_activity_settings">SettingsActivity</string> <string name="settings_button_save">save</string> <string name="settings_button_cancel">cancel</string> </resources>
翻譯完成
分分鐘搞定
(我只翻會出現的字)
Step #5
回編譯
非常實用的教學 小弟想學彈窗不知道可否教學一份
回覆刪除這個已經在預定排程中了
刪除應該近期會發
非常感謝 不知道是否以手機做示範ㄋ
回覆刪除大大的東西真的幫註甚多
手機頗難打字...
刪除手機和電腦操作的原理是一樣的
只要看懂在手機上也能操作