"[Manuel de développement d'applications Android](https://www.amazon.co.jp/%E5%9F%BA%E7%A4%8E%EF%BC%86%E5%BF%9C%E7%94%" A8% E5% 8A% 9B% E3% 82% 92% E3% 81% 97% E3% 81% A3% E3% 81% 8B% E3% 82% 8A% E8% 82% B2% E6% 88% 90% EF% BC% 81-Android% E3% 82% A2% E3% 83% 97% E3% 83% AA% E9% 96% 8B% E7% 99% BA% E3% 81% AE% E6% 95% 99% E7% A7% 91% E6% 9B% B8-% E3% 81% AA% E3% 82% 93% E3% 81% A1% E3% 82% 83% E3% 81% A3% E3% 81% A6% E9 % 96% 8B% E7% 99% BA% E8% 80% 85% E3% 81% AB% E3% 81% AA% E3% 82% 89% E3% 81% AA% E3% 81% 84% E3% 81 % 9F% E3% 82% 81% E3% 81% AE% E5% AE% 9F% E8% B7% B5% E3% 83% 8F% E3% 83% B3% E3% 82% BA% E3% 82% AA % E3% 83% B3-WINGS% E3% 83% 97% E3% 83% AD% E3% 82% B8% E3% 82% A7% E3% 82% AF% E3% 83% 88% E9% BD% 8A % E8% 97% A4-% E6% 96% B0% E4% B8% 89-ebook / dp / B078X8H61T / ref = sr_1_2? __Mk_ja_JP =% E3% 82% AB% E3% 82% BF% E3% 82% AB % E3% 83% 8A & dchild = 1 & keywords = Android% E3% 82% A2% E3% 83% 97% E3% 83% AA% E9% 96% 8B% E7% 99% BA% E3% 81% AE% E6% 95 % 99% E7% A7% 91% E6% 9B% B8 & qid = 1587897459 & sr = 8-2 "Manuel de développement d'applications Android") "
Maintenant que j'ai terminé toutes les étapes, cette fois je vais vous expliquer la vue à l'aide d'images.
Cela fait 3 mois que j'ai changé de travail pour Sier. Cela fait un mois que j'ai été affecté sur le site après la formation. J'étudie les applications Android que j'utiliserai à l'avenir, je les écrirai donc dans la sortie. Je suis un amateur.
androidstudio 3.6.2 openjdk version "11.0.6"
Créez un écran comme celui-ci.
Une vue est un composant d'écran. Aussi appelé widget. Sur l'écran ci-dessus, "Entrez votre nom" est également une vue, un bouton pour sélectionner un homme ou une femme (bouton radio) est également une vue, et une liste de boissons est également une vue.
Quand cela est codé, cela ressemble à ceci.
res/values/string.xml
<resources>
<string name="app_name">Échantillon de pièces d'écran</string>
<string name="tv_msg">S'il vous plaît entrez votre nom.</string>
<string name="bt_save">sauvegarder</string>
<string name="cb_drink">Boisson</string>
<string name="cb_food">capuche</string>
<string name="rb_male">Homme</string>
<string name="rb_female">femme</string>
<string-array name="dlinkllist">
<item>Cola</item>
<item>Thé oolong</item>
<item>cacao</item>
<item>Jus de légumes</item>
</string-array>
</resources>
C'est ici que vous entrez le texte que vous souhaitez afficher dans chaque vue. Si vous entrez ce nom = "○○" ○○ dans l'attribut de texte ci-dessous comme indiqué dans l'exemple, vous pouvez l'utiliser comme texte dans la vue saisie.
res/layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1A9BA"
android:orientation="vertical">
<TextView
android:id="@+id/tvLabelInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:text="@string/tv_msg"
android:textSize="25sp"/>
<EditText
android:id="@+id/etInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:inputType="text"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#df7401"
android:orientation="horizontal">
<CheckBox
android:id="@+id/cbDrink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:background="#ffffff"
android:text="@string/cb_drink"/>
<CheckBox
android:id="@+id/cbFood"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="@string/cb_food"/>
</LinearLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#df7401"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<RadioButton
android:id="@+id/rbMale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="#ffffff"
android:text="@string/rb_male"/>
<RadioButton
android:id="@+id/rbFemale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="@string/rb_female"/>
</RadioGroup>
<Button
android:id="@+id/btSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bt_save"/>
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ffffff"
android:entries="@array/dlinkllist"/>
</LinearLayout>
Écrivez la partie XX de string.xml dans l'élément de texte de chaque vue. Puis string.xml De plus, concernant layout_width et layout_marginBottom, il décide de la disposition et de la forme de la vue.
C'est comme écrire, mais ça ressemble à ça. RadioGroup décrit RadioButton comme un élément enfant. Lorsque LinearLayout est un élément parent, il décide s'il faut organiser ses éléments enfants verticalement ou horizontalement. (Oriental = partie "verticale") Il y a d'autres rôles, mais je me demande si cette compréhension est suffisante pour cet échantillon.
C'est assez simple, mais j'ai essayé de résumer le point de vue à ma manière. Cela ne se déroule pas comme je m'y attendais, mais je pense continuer.
La prochaine fois, je résumerai les événements et les auditeurs.
Recommended Posts