0

ビューフリッパーの左右に2つのボタンがあるビューフリッパーがあります。 ここに画像の説明を入力

ビューフリッパーにテキストが投影されています。エミュレーターを実行すると、viewFlipper に表示されるテキストが 2 つのボタンを画面から押し出し、スペース全体を占有します。

ビューフリッパーのテキストのレイアウトがビューフリッパーのレイアウト内でボタンやスティックを押し出さないようにするにはどうすればよいですか?

ここに画像の説明を入力

これは、viewflipper の xml レイアウトです。

 <Button
    android:id="@+id/button_left"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/promoflipper"
    android:background="@drawable/button_left"
    android:layout_below="@+id/titel1" 
    android:layout_alignParentLeft="true"
       />

<Button
    android:id="@+id/button_right"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/promoflipper"
    android:background="@drawable/button_right" 
    android:layout_below="@+id/titel1" 
    android:layout_alignParentRight="true"
    />

<ViewFlipper
    android:id="@+id/promoflipper"
    style="@style/MainTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/titel1"
    android:layout_centerInParent="true"
    android:background="@drawable/mat" 
    >


</ViewFlipper>

これは、viewflipper 上のテキストの xml レイアウトです。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/promo_flipper"

>

<TextView
    android:id="@+id/promoTitel"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dip"
    android:text="@string/promoTitel"
    android:textColor="@color/listSelectorFocused2"
    android:textSize="16dip" 
    />

<TextView
    android:id="@+id/promoText"
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="@color/listSelectorPressed3"
    android:gravity="center"
    android:padding="10dip" />

<com.phi.android.ui.widget.AutoResizeTextView
    android:id="@+id/promoLine"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dip"
    android:textColor="@color/listSelectorFocused2"
    android:textSize="16sp" />

これはコードです:

    LinearLayout flipLayout = (LinearLayout) inflater.inflate(
                    R.layout.promo_flipper,
                    promoFlipper, false);
            TextView promoTitel = (TextView) flipLayout
                    .findViewById(R.id.promoTitel);
            TextView promoText = (TextView) flipLayout
                    .findViewById(R.id.promoText);

            // Make a textholder
            String text = "";
            // Get the list with this Place's Promo's
            List<Promo> promos = promoList.get(i);
            // Run through the promo's and add them to the textholder
            for (Promo promo : promos) {
                text += promo.getDescription() + "\n";
            }
            // Set the title and promo text
            promoTitel.setText(getResources()
                    .getString(R.string.promoTitel)
                    + " "
                    + placeList.get(i).getName());
            promoText.setText(text);

            // Add the inflated view to the flipper
            promoFlipper.addView(flipLayout);
4

0 に答える 0