У меня есть некоторые проблемы с динамическим добавлением linearlayout. Он добавляется в верхней части экрана, накладывает другие linearlayout.Linearlayout overlay another linearlayout
Здесь XML, код и результаты.
XML:
<TextView
android:id="@+id/top_km"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#888"
android:gravity="top"
android:textColor="#fff"
android:textSize="30dip"
android:layout_centerHorizontal="true"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/top_km"
android:id="@id/textLayout">
</RelativeLayout>
Код:
myLayout = (RelativeLayout) page.findViewById(R.id.textLayout);
LinearLayout linLayout = new LinearLayout(this);
linLayout.setOrientation(LinearLayout.VERTICAL);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
myLayout.addView(linLayout);
LinearLayout hozLayout = new LinearLayout(this);
hozLayout.setOrientation(LinearLayout.HORIZONTAL);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
myLayout.addView(hozLayout);
Результаты: enter link description here
Благодарности
Я пытался сделать это: RelativeLayout.LayoutParams PARAMS = новые RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.addRule (RelativeLayout.ALIGN_BOTTOM, id_value_layout-1); hozLayout.setLayoutParams (params); Но ситуация такая же. – Postnik