android - Dynamically arrange the margins of TextView -
android - Dynamically arrange the margins of TextView -
i working on custom array adapter. using extended textview shrinks if text larger. listview item layout follows
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:orientation="horizontal" android:weightsum="3" > <linearlayout android:id="@+id/textlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.8" android:orientation="horizontal" > <linearlayout android:id="@+id/textlabellayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="10dp" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="10dp" android:layout_weight="1.0" android:orientation="vertical" > <ft.mobile.client.android.widget.autoresizetextview android:id="@+id/accountnamelabel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:includefontpadding="false" android:maxlines="1" android:text="ropl-12345111000" custom:datatype="account" custom:maxlinecount="2" custom:minfontsize="10" custom:preferredlinecount="1" custom:shrinktexttofit="true" /> </linearlayout> <linearlayout android:id="@+id/textvaluelayout" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginbottom="10dp" android:layout_marginleft="05dp" android:layout_marginright="05dp" android:layout_margintop="10dp" android:layout_weight="1.2" android:orientation="horizontal" > <textview android:id="@+id/accountbalancelabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:drawableright="@drawable/drill_down" android:ellipsize="none" android:singleline="false" android:text="amount" android:textcolor="@color/black" android:textsize="14dp" android:textstyle="bold" /> </linearlayout> </linearlayout>
the thing when first text view larger comes on textview nowadays in front end of textview. want dynamically give margin texview come @ bottom
just utilize layoutparams :
layoutparams params = new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content ); params.setmargins(left, top, right, bottom); yourbutton.setlayoutparams(params);
depending on layout you're using should utilize relativelayout.layoutparams
or linearlayout.layoutparams
.
android textview
Comments
Post a Comment