android - EditText going down screen -
android studio screenshoti have edittext set width 0dp made weight 1 still spans across screen , height wrap_content reason, comes line going right down screen no width. please me right?
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" 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="com.example.user.zidcalculator.mainactivity"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_alignparenttop="true" android:layout_alignparentstart="true"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="enter 2 numbers below , perform operation see output" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="enter first number"/> <edittext android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"/> </linearlayout> </relativelayout>
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" 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" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_alignparenttop="true" android:layout_alignparentstart="true" android:layout_alignparentleft="true"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="enter 2 numbers below , perform operation see output" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="enter first number"/> <edittext android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"/> </linearlayout> </linearlayout> </relativelayout>
your problem in
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"/>
it should
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> </linearlayout>
Comments
Post a Comment