android - Center gravity in ScrollView -
hi have problem centering textview in scrollview. want center textviews ids hajs
, textview01
, textview02
vertically in order in center of height of imageviews. it's strange because in android studio design see right, when try on device these textviews in top of textview.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <scrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/scrollview" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_alignparentend="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:fillviewport="true"> <relativelayout android:id="@+id/relativelayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical|center_horizontal" > <textview android:id="@+id/hajs" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/imageview1" android:layout_alignparentleft="true" android:layout_aligntop="@+id/imageview1" android:layout_centerinparent="true" android:layout_toleftof="@+id/imageview1" android:background="#41bf17" android:gravity="center_vertical|center|center_horizontal" android:text="0" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#fff" android:textsize="70sp" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:background="#41bf17" android:gravity="center" android:text="@string/zaoszczedziles" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#fff" android:textstyle="bold" /> <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@+id/textview2" android:adjustviewbounds="true" android:background="#41bf17" android:maxwidth="100dp" android:src="@drawable/moneybag" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_below="@+id/hajs" android:background="#41bf17" android:gravity="center" android:text="@string/dni_bez_papierosow" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#fff" android:textstyle="bold" /> <imageview android:id="@+id/imageview01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@+id/textview3" android:adjustviewbounds="true" android:background="#41bf17" android:maxwidth="100dp" android:src="@drawable/calendar" /> <textview android:id="@+id/textview01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/imageview01" android:layout_alignparentleft="true" android:layout_alignright="@+id/hajs" android:layout_aligntop="@+id/imageview01" android:layout_centerinparent="true" android:background="#41bf17" android:gravity="center" android:text="0" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#fff" android:textsize="70sp" /> </relativelayout> </scrollview> </relativelayout>
Comments
Post a Comment