Ich habe ein Layout erstellt, die dieses LayoutInflating Nested-Layout mit RadioButton- zu einem Container
Problem Radiobutton enthalten zu einem Behälter aufgeblasen werden: Das Layout aufgeblasen, aber alle Optionsschaltfläche angezeigt bekommt, ist das falsch? .
Layout enthält Optionsfeld zum Aufblasen im Container.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="23dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
-Layout für den Container
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioGroup
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Code, um das Kind Inflating
LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0 ; i < 6 ; i++){
LinearLayout child =(LinearLayout) inflater.inflate(R.layout.layout_linear_with_rb,container,false);
container.addView(child);
}
Screenshot:RadioButton screenshot containing someview
Ich habe ein Problem, das LinearLayout, dass das Elternteil des RadioButton enthält einige Ansicht, ich habe es nicht in meine Frage aufgenommen Es tut mir leid. – tabztabarangao
Versuchen Sie, auch die LinearLayouts mit eindeutigen IDs zu versehen. –
Ich habe den Screenshot meines Radiobutton-Layouts hinzugefügt – tabztabarangao