android - Matching the text layout on the viewFlipper layout -
i have viewflipper 2 buttons, left , right of view flipper.
there text being projected on viewflipper. when run emulator text comes on viewflipper pushes 2 buttons out of screen en takes entire space.
how can make sure layout of text on viewflipper doesn't push out buttons , sticks within layout of viewflipper?
this xml layout of viewflipper
<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>
this xml layout of text on viewflipper
<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" />
and code:
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 textholder string text = ""; // list place's promo's list<promo> promos = promolist.get(i); // run through promo's , add them textholder (promo promo : promos) { text += promo.getdescription() + "\n"; } // set title , promo text promotitel.settext(getresources() .getstring(r.string.promotitel) + " " + placelist.get(i).getname()); promotext.settext(text); // add inflated view flipper promoflipper.addview(fliplayout);
Comments
Post a Comment