Supposons que j'ai un xml simple mise en page comme ce qui suit:gonfler vs findViewById
button.xml:
<Button
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Y a-t-il des différences dans les appels suivants? et lequel devrais-je utiliser?
button = (Button) getLayoutInflater().inflate(R.layout.button, null);
et
View v = getLayoutInflater().inflate(R.layout.button, null);
button = (Button) v.findViewById(R.id.button01);
Oups, cela filtre mon code. ici: bouton \t xmlns: android = "http://schemas.android.com/apk/res/android" \t android: id = "@ + id/button01" \t android: layout_width = "wrap_content" \t android: layout_height = "wrap_content" –