Załóżmy, że mam prosty układ xml jak poniżej:nadmuchać 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" />
Czy są jakieś różnice w następujących połączeń? i który powinienem użyć?
button = (Button) getLayoutInflater().inflate(R.layout.button, null);
i
View v = getLayoutInflater().inflate(R.layout.button, null);
button = (Button) v.findViewById(R.id.button01);
Ups, odfiltrowuje mój kod. tutaj: Przycisk \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" –