Android アプリケーションの開発を始めたとき、特にレイアウト ファイルなど、必要な場所にカスタム R 値を定義する傾向がありました。例えば:
findViewById(R.id.customerName).setText(customer.getName())
レイアウト付き:
<TextView android:text="TextView" android:id="@id/customerName"
android:layout_height="wrap_content" android:layout_width="fill_parent" />
android.R
今では、代わりに使用する方が良いかもしれないことに気づきました。
findViewById(android.R.id.text1).setText(customer.getName())
レイアウト付き:
<TextView android:text="TextView" android:id="@android:id/text1"
android:layout_height="wrap_content" android:layout_width="fill_parent" />
あなたはどのような習慣に従っていますか?それぞれの長所と短所は何ですか?