i've tested linearlayout , 2 textviews. in both same text different textsize. tried set height , width in xml , in java , tried height 0dp , weight 1. don't understand why second textview lower? how can set them on same height?
in later step need in tablelayout textviews , edittexts , should crossword puzzle. after didn't work there, i've tested simple testapp.
how looks like: http://i.stack.imgur.com/in1yl.png
xml file:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:background="@drawable/cell_border" android:id="@+id/textview1" android:layout_width="60dp" android:layout_height="60dp" android:singleline = "false" > </textview> <textview android:background="@drawable/cell_border" android:id="@+id/textview2" android:layout_width="60dp" android:layout_height="60dp" android:singleline = "false" android:textsize="6.5sp" > </textview> </linearlayout>
javacode:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview vtext = (textview)findviewbyid(r.id.textview1); vtext.settext("dies ist ein test"); //vtext.setwidth(60); //vtext.setheight(60); textview vtext2 = (textview)findviewbyid(r.id.textview2); vtext2.settext("dies ist ein test"); //vtext2.setwidth(60); //vtext2.setheight(60); }
thank in matter.
put
android:baselinealigned="false"
in <linearlayout>
. resolve issue.
Comments
Post a Comment