xml - Android text alignment changed automatically -
trying create layout working yesterday today opened xml view text of controls right aligned happen every screen.
<relativelayout 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:background="@drawable/bg" > <relativelayout android:id="@+id/layout_logo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/layout_loginarea" android:gravity="center_horizontal" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" /> </relativelayout> <linearlayout android:id="@+id/layout_loginarea" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerinparent="true" android:gravity="center" android:orientation="vertical" android:padding="10dp" > <edittext android:id="@+id/edit_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/txt_box" android:hint="@string/usernamehint" android:inputtype="textpersonname" android:paddingbottom="4dp" android:paddingleft="6dp" android:paddingright="6dp" android:paddingtop="4dp" android:textcolor="#ffffff" android:textcolorhint="#ffffff" /> <edittext android:id="@+id/edit_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="3dp" android:background="@drawable/txt_box" android:hint="@string/passwordhint" android:inputtype="textpassword" android:padding="4dp" android:paddingbottom="4dp" android:paddingleft="6dp" android:paddingright="6dp" android:paddingtop="4dp" android:textcolor="#ffffff" android:textcolorhint="#ffffff" /> <button android:id="@+id/button_login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margintop="3dp" android:background="@drawable/signin_button" android:text="@string/loginbuttontext" /> <textview android:id="@+id/txt_forgotpassword" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="10dp" android:gravity="center_horizontal" android:text="@string/forgotpassword" /> </linearlayout> <linearlayout android:id="@+id/layout_createaccount" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:gravity="center" android:orientation="vertical" android:padding="10dp" > <button android:id="@+id/button_facebook" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/facebook_button" android:text="@string/createaccount" /> <button android:id="@+id/button_createaccount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/create_account" /> </linearlayout> </relativelayout>
set width
of view
, make view
gravity="center"
<linearlayout android:id="@+id/layout_createaccount" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:orientation="vertical" android:padding="10dp" > <button android:id="@+id/button_facebook" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@color/app_bg" android:gravity="center" android:text="createaccount" /> <button android:id="@+id/button_createaccount" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_margintop="2dp" android:background="@color/app_bg" android:gravity="center" android:text="createaccount" /> </linearlayout>
Comments
Post a Comment