0

次のコードのように ListView Size を動的に変更するこのアプリケーションを実行しています。

RelativeLayout.LayoutParams mParam = new   RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
sucs.setLayoutParams(myListView);

しかし、これを行うと、ListView がビューの上に表示されます。テキストビューの下にあるはずの場所に配置する方法はありますか?

前もって感謝します!

編集済み: ここに私のxmlがあります:

<TextView
    android:id="@+id/sucursales_empresa"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/direccion_empresa"
    android:background="@drawable/barra"
    android:text="@string/sucursales"
    android:visibility="gone" />

<ListView
    android:id="@+id/sucursalesEmpresaList"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/sucursales_empresa"
    android:cacheColorHint="#00000000"
    android:visibility="gone" />
4

2 に答える 2

0

これを試して

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
  ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, view.getId());

  view.setLayoutParams(params);
  ViewGroup parentView = (ViewGroup) findViewById(R.id.viewgroup);
  parentView.addView(mylsitview);
于 2012-07-13T05:22:02.143 に答える
0

このようにリストビューのLayoutParamsのルールを追加する必要があります..

RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(
               LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);                
params1.addRule(RelativeLayout.BELOW, R.id.textview);
listview.setLayoutParams(params1);
于 2012-07-13T05:18:44.413 に答える