<?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:id="#+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true" >
<LinearLayout
android:id="#+id/MainParent"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="454dp"
android:layout_gravity="bottom"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80sp"
android:text="Sim Card Master"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/pumpkinorange"
android:textSize="17sp" />
<TextView
android:id="#+id/simno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:text="Sim No"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/darkblue"
android:textSize="14sp" />
<EditText
android:id="#+id/simName"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:selectAllOnFocus="true" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/TextView01"
android:layout_width="145dp"
android:layout_height="wrap_content"
android:text="Service Provider"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/darkblue"
android:textSize="14sp" />
<Spinner
android:id="#+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="#array/service_arrays"
android:prompt="#string/serviceprovid" />
<TextView
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100sp"
android:layout_marginTop="5dp"
android:text="Unit Master"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/pumpkinorange"
android:textSize="17sp" />
<TextView
android:id="#+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:text="Unit No"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/darkblue"
android:textSize="14sp" />
<EditText
android:id="#+id/unitNo"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:ems="10"
android:selectAllOnFocus="true" />
<TextView
android:id="#+id/TextView04"
android:layout_width="145dp"
android:layout_height="wrap_content"
android:text="IMEI No"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/darkblue"
android:textSize="14sp" />
<EditText
android:id="#+id/imeiNo"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:ems="10"
android:selectAllOnFocus="true"/>
<TextView
android:id="#+id/vehicleNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80sp"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Vehicle Master"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/pumpkinorange"
android:textSize="17sp" />
<TextView
android:id="#+id/TextView06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Vehicle No"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/darkblue"
android:textSize="14sp" />
<EditText
android:id="#+id/vehicleNo"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:ems="10"
android:selectAllOnFocus="true"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_gravity="center"
android:text="Save"
android:textSize="15sp"
android:textStyle="italic"
android:typeface="normal" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Reset"
android:textSize="15sp"
android:textStyle="italic"
android:typeface="normal" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I don't know to correct this error. In xml layout i can see the button, but in the emulator its not visible or button not scrolled. also i want this two button in same line with left and right alignment.
You Specified inside scrollview second linearlayout as
<LinearLayout
android:layout_width="match_parent"
android:layout_height="454dp"
android:layout_gravity="bottom"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:orientation="vertical" >
change to
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:orientation="vertical" >
You Specified height fixed that why it does't display...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="3dp"
>
<Button
android:id="#+id/login_btn"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="0.5"
android:text="Login"
/>
<Button
android:id="#+id/cancel_btn"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="0.5"
android:text="Cancel"
/>
</LinearLayout>
Set your ScrollView's height to match_parent
<ScrollView
android:id="#+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
Related
i am using scrollview in Linearlayout , the problem is layout respond normally, as soon as i start scrolling, it laggs too much.
< LinearLayout >
< ScrollView >
< Linearlayout >..sub (LinearLayout)..< /LinearLayout >
< ScrollView>
< LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
android:orientation="vertical"
android:background="#drawable/round_edittext"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/pddd"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/profile_user_email_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Complete Your profile"
android:textAlignment="center"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:background="#drawable/round_edittext"
android:inputType="textCapSentences"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile : "
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_mobile_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5sp"
android:background="#drawable/round_edittext"
android:inputType="number"
android:maxLength="10"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold"
/>
</LinearLayout>
<RadioButton
android:id="#+id/profile_faculty_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="20sp"
android:text="Faculty"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/profile_parents_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="10sp"
android:text="Parents"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<LinearLayout
android:id="#+id/layout_faculty_key_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="6">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<EditText
android:id="#+id/pff_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/faculty_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/proile_activity_unique_key_linearlayout_id"
>
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold"
/>
<EditText
android:id="#+id/profile_activity_school_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/profile_activity_school_key_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold"
/>
<ImageView
android:id="#+id/profile_activity_school_key_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="20sp"
android:orientation="horizontal"
>
<Spinner
android:id="#+id/activityprofile_spinner_id"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginLeft="50sp"
>
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="#+id/profile_saveinfo_id"
android:layout_width="100sp"
android:layout_height="50sp"
android:layout_gravity="center_horizontal"
android:background="#drawable/save2" />
<Button
android:id="#+id/profile_nagivate_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Navigate" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
i have used this code for my Linearlayout, As soon as i touch radioButton or edittext or i scrolldown, It start lagging alot. Im not able to understand the problem, the images i have used are small size below 100kb
I edited your code and took out about 4 LinearLayouts which were unnecessary. Please test it for performance. If it still is slow try substituting some of the remaining vertical LinearLayouts with RelativeLayouts as #IshitaShinha suggested.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/round_edittext"
android:orientation="vertical"
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:background="#drawable/pddd"
android:orientation="vertical">
<TextView
android:id="#+id/profile_user_email_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Complete Your profile"
android:textAlignment="center"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:background="#drawable/round_edittext"
android:inputType="textCapSentences"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile : "
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profileActivity_student_mobile_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5sp"
android:background="#drawable/round_edittext"
android:inputType="number"
android:maxLength="10"
android:textColor="#000"
android:textSize="25sp"
android:textStyle="bold" />
</LinearLayout>
<RadioButton
android:id="#+id/profile_faculty_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="20sp"
android:text="Faculty"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/profile_parents_radio_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginTop="10sp"
android:text="Parents"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/layout_faculty_key_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="6">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/pff_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold" />
<ImageView
android:id="#+id/faculty_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/proile_activity_unique_key_linearlayout_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Key :"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="#+id/profile_activity_school_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_weight="3"
android:background="#drawable/round_edittext"
android:inputType="text|textNoSuggestions"
android:textColor="#000"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/profile_activity_school_key_verify_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/check"
android:textColor="#000"
android:textStyle="bold" />
<ImageView
android:id="#+id/profile_activity_school_key_cancle_bt_id"
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:background="#drawable/minus1"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<Spinner
android:id="#+id/activityprofile_spinner_id"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginLeft="50sp"
android:layout_marginTop="20sp" />
<Button
android:id="#+id/profile_saveinfo_id"
android:layout_width="100sp"
android:layout_height="50sp"
android:layout_gravity="center_horizontal"
android:background="#drawable/save2" />
<Button
android:id="#+id/profile_nagivate_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Navigate" />
</LinearLayout>
</ScrollView>
This is the my current listivew:
My problem is i can't display my last item in the list. It's like getting cut by my phone.
Here is the xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="280dp"
android:background="#drawable/dfcomment3"
android:layout_weight="0.07">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Add comment"
android:id="#+id/button12"
android:layout_marginTop="215dp"
android:layout_marginLeft="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Update Post"
android:id="#+id/button13"
android:layout_marginTop="215dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Close This"
android:id="#+id/button14"
android:layout_marginTop="215dp" />
</LinearLayout>
<TextView
android:layout_marginLeft="10dp"
android:textSize="35dp"
android:id="#+id/textView11"
android:gravity="center"
android:text="ID"
android:textStyle="bold"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView12"
android:text="Name"
android:textSize="16dp"
android:textColor="#994495"
android:layout_marginTop="190dp"
android:layout_marginLeft="210dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView13"
android:text="Lastname"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginLeft="90dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/id"
android:layout_toEndOf="#+id/id"
android:layout_marginTop="5dp" />
<TextView
android:id="#+id/textView14"
android:text="title"
android:textSize="15dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="260dp"
android:layout_below="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_marginTop="190dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="descr"
android:textSize="21dp"
android:textColor="#994495"
android:id="#+id/textView15"
android:layout_marginLeft="110dp"
android:layout_marginTop="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dept"
android:textStyle="italic"
android:textColor="#994495"
android:id="#+id/textView16"
android:layout_marginLeft="180dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tags"
android:textStyle="italic"
android:textSize="14dp"
android:textColor="#994495"
android:id="#+id/textView17"
android:layout_marginLeft="120dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="status"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="#70CC86"
android:id="#+id/textView18"
android:layout_marginLeft="290dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:textColor="#994495"
android:id="#+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginTop="190dp" />
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
As much as possible i want to stick with the listview because i'm not familiar with the recyclerview. if theres any way to fix this, i would be glad.
Check the image for the reference of my problem.
There's actually 4 items in the list and i can only view 2 items.
Firstly there is problem with your XML as when you use weightsum and layout_weight then you need not give dimensions in height or width.
This must be your XML.
Also I checked your XML there is some problem in you XML attributes too. Like you used "android:layout_below="#+id/id"" but in your xml there is no "id"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#drawable/dfcomment3"
android:layout_weight="70">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Add comment"
android:id="#+id/button12"
android:layout_marginTop="215dp"
android:layout_marginLeft="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Update Post"
android:id="#+id/button13"
android:layout_marginTop="215dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Close This"
android:id="#+id/button14"
android:layout_marginTop="215dp" />
</LinearLayout>
<TextView
android:layout_marginLeft="10dp"
android:textSize="35dp"
android:id="#+id/textView11"
android:gravity="center"
android:text="ID"
android:textStyle="bold"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView12"
android:text="Name"
android:textSize="16dp"
android:textColor="#994495"
android:layout_marginTop="190dp"
android:layout_marginLeft="210dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView13"
android:text="Lastname"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginLeft="90dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/id"
android:layout_toEndOf="#+id/id"
android:layout_marginTop="5dp" />
<TextView
android:id="#+id/textView14"
android:text="title"
android:textSize="15dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="260dp"
android:layout_below="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_marginTop="190dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="descr"
android:textSize="21dp"
android:textColor="#994495"
android:id="#+id/textView15"
android:layout_marginLeft="110dp"
android:layout_marginTop="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dept"
android:textStyle="italic"
android:textColor="#994495"
android:id="#+id/textView16"
android:layout_marginLeft="180dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tags"
android:textStyle="italic"
android:textSize="14dp"
android:textColor="#994495"
android:id="#+id/textView17"
android:layout_marginLeft="120dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="status"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="#70CC86"
android:id="#+id/textView18"
android:layout_marginLeft="290dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:textColor="#994495"
android:id="#+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginTop="190dp" />
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_weight="30"
android:layout_height="0dp" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</LinearLayout>
Add your java code if you are not getting 4 values into your ListView
Change you xml to :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="280dp"
android:layout_weight="0.07"--> Delete this
>
....
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_weight="1" -> Add this
android:layout_height="0dp" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
I want to move my layout above when keyboard is on. I have tried with android:windowSoftInputMode="adjustPan|adjustResize". But this is not working.
When I click on EditText it should move above so that the TextView should be visible.
<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:orientation="vertical"
tools:context=".EnterPin" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/top_bar"
android:padding="3dp" >
<Button
android:id="#+id/btn_home_change_pin"
android:layout_width="45dp"
android:layout_height="28dp"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:background="#drawable/grey_btn_selector"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Home"
android:textColor="#417883"
android:textSize="11sp" />
<TextView
android:id="#+id/txt_company_name_check_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="BURBLE ME"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:paddingLeft="10dp"
android:text="Thank you for claiming your account"
android:textColor="#5DA5AE"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="9dp"
android:layout_marginLeft="5dp"
android:text="Now please enter a PIN.You will use this to allow other Burble enables Dropzones to import you."
android:textSize="14dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="18dp" >
<EditText
android:id="#+id/edt_current_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:background="#drawable/edittext_shape"
android:ems="10"
android:hint="Enter Pin"
android:padding="10dp"
android:textSize="14sp"
android:gravity="center_horizontal"
android:inputType="numberPassword"
android:singleLine="true" >
</EditText>
<EditText
android:id="#+id/edt_confirm_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:background="#drawable/edittext_shape"
android:ems="10"
android:hint="Confirm Pin"
android:padding="10dp"
android:textSize="14sp"
android:gravity="center_horizontal"
android:inputType="numberPassword"
android:singleLine="true" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp"
android:weightSum="2" >
<Button
android:id="#+id/btn_pin_back"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:background="#drawable/button_selector"
android:shadowColor="#ffffff"
android:shadowDx="1.5"
android:shadowDy="2"
android:shadowRadius="2"
android:text="Back"
android:textSize="15dp" />
<Button
android:id="#+id/btn_change_pin"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:background="#drawable/button_selector"
android:shadowColor="#ffffff"
android:shadowDx="1.5"
android:shadowDy="2"
android:shadowRadius="2"
android:text="Next"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:text="What will I use this for?"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:text="You will use your PIN at your dropzone to manifest using their equipment and to allow a new dropzone to add you to their Burble system."
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
Add this line of code in manifest activity declaration.
<activity
android:name=".ACTIVITY NAME"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustResize"/>
Add this lines in your AndroidManifest.xml
android:windowSoftInputMode="adjustPan"
here is your layout .
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3dp" >
<Button
android:id="#+id/btn_home_change_pin"
android:layout_width="45dp"
android:layout_height="28dp"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Home"
android:textColor="#417883"
android:textSize="11sp" />
<TextView
android:id="#+id/txt_company_name_check_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="BURBLE ME"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:paddingLeft="10dp"
android:text="Thank you for claiming your account"
android:textColor="#5DA5AE"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:layout_marginTop="9dp"
android:text="Now please enter a PIN.You will use this to allow other Burble enables Dropzones to import you."
android:textSize="14dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="18dp" >
<EditText
android:id="#+id/edt_current_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Pin"
android:inputType="numberPassword"
android:padding="10dp"
android:singleLine="true"
android:textSize="14sp" >
</EditText>
<EditText
android:id="#+id/edt_confirm_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Confirm Pin"
android:inputType="numberPassword"
android:padding="10dp"
android:singleLine="true"
android:textSize="14sp" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp"
android:weightSum="2" >
<Button
android:id="#+id/btn_pin_back"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:shadowColor="#ffffff"
android:shadowDx="1.5"
android:shadowDy="2"
android:shadowRadius="2"
android:text="Back"
android:textSize="15dp" />
<Button
android:id="#+id/btn_change_pin"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:shadowColor="#ffffff"
android:shadowDx="1.5"
android:shadowDy="2"
android:shadowRadius="2"
android:text="Next"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:text="What will I use this for?"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:text="You will use your PIN at your dropzone to manifest using their equipment and to allow a new dropzone to add you to their Burble system."
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Add the line below to the activity this layout is inflated in. (AndroidManifest.xml) android:windowSoftInputMode="stateUnchanged|adjustPan"
The next code is OK for Eclipse Layout Editor and Android Studio. I tested it in several mobiles and works fine but, in a Samsung GT-S6310N (Android 4.1.2), this EditText dissapears. It goes at the end of a LinearLayout that defines the Layout width. The Layout is showed in a Dialog using android:Theme.Dialog.
<EditText
android:id="#+id/et_clino"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="numberDecimal"
android:text="89.9" />
I've solved this changing the code to:
<EditText
android:id="#+id/et_clino"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="4"
android:inputType="numberDecimal"
android:text="89.9" />
The question is: is wrong mi code or is a bug?
This is the code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp"
tools:context=".Measure" >
<RelativeLayout
android:id="#+id/rl_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignBaseline="#+id/et_from"
android:text="#string/from"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/TextView1"
android:ems="7"
android:hint="#string/from"
android:lines="1"
android:maxLength="7"
android:minLines="1"
android:nextFocusDown="#+id/et_to"
android:text="1234567" />
<EditText
android:id="#+id/et_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/et_from"
android:layout_alignParentRight="true"
android:ems="7"
android:hint="#string/to"
android:maxLength="7"
android:maxLines="1"
android:nextFocusDown="#+id/et_distance"
android:text="1234567" />
<TextView
android:id="#+id/TextView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/et_from"
android:layout_toLeftOf="#+id/et_to"
android:text="#string/to"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="#+id/ll_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distance_abr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/green" />
<EditText
android:id="#+id/et_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:hint="#string/distance_abr"
android:inputType="numberDecimal"
android:lines="5"
android:maxLength="6"
android:nextFocusDown="#+id/et_rumbomag" />
<TextView
android:id="#+id/TextView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/rumbo_mn_abr"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_rumbomag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:hint="#string/rumbo_mn_abr"
android:inputType="numberDecimal"
android:maxLength="5"
android:nextFocusDown="#+id/et_measured_clino"
android:text="360.0" />
<TextView
android:id="#+id/tv_clino"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/clino"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_clino"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="4"
android:inputType="numberDecimal"
android:text="89.9" />
<!-- Así produce error: el et_clino desaparece y el tv_clino se estrecha y muestra el texto en 3 líneas
<EditText
android:id="#+id/et_clino"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="numberDecimal"
android:text="89.9" />
-->
</LinearLayout>
<LinearLayout
android:id="#+id/ll_d"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioGroup
android:id="#+id/rg_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rb_direct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:hint="#string/direction"
android:text="#string/direct" />
<RadioButton
android:id="#+id/rb_inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="#string/inverse" />
</RadioGroup>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" >
<!--
<Button
android:id="#+id/btn_get_from_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BT"
android:textColor="#color/blue" />
-->
<Button
android:id="#+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text="#string/delete"
android:textColor="#color/red" />
<ImageButton
android:id="#+id/ib_disto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="#drawable/disto" />
<Button
android:id="#+id/btn_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="#string/save"
android:textColor="#color/green" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_e"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/et_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/description" >
<requestFocus />
</EditText>
</LinearLayout>
I've made some changes (particularly the LinearLayout containing the cli_no EditText, #string and #drawable resources) in the xml file as below:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="#+id/rl_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/et_from"
android:layout_alignParentLeft="true"
android:text="#string/from"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/TextView1"
android:ems="7"
android:hint="#string/from"
android:lines="1"
android:maxLength="7"
android:minLines="1"
android:nextFocusDown="#+id/et_to"
android:text="1234567" />
<EditText
android:id="#+id/et_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/et_from"
android:layout_alignParentRight="true"
android:ems="7"
android:hint="#string/to"
android:maxLength="7"
android:maxLines="1"
android:nextFocusDown="#+id/et_distance"
android:text="1234567" />
<TextView
android:id="#+id/TextView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/et_from"
android:layout_toLeftOf="#+id/et_to"
android:text="#string/to"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="#+id/ll_b"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv_distance"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="distance_abr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/green" />
<EditText
android:id="#+id/et_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ems="4"
android:layout_weight="1"
android:hint="distance_abr"
android:inputType="numberDecimal"
android:lines="5"
android:maxLength="6"
android:nextFocusDown="#+id/et_rumbomag" />
<TextView
android:id="#+id/TextView3"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="distance_abr"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_rumbomag"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:ems="4"
android:hint="rumbo"
android:inputType="numberDecimal"
android:maxLength="5"
android:text="360.0" />
<TextView
android:id="#+id/tv_clino"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="clino"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/et_clino"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="4"
android:inputType="numberDecimal"
android:text="89.9" />
</LinearLayout>
<LinearLayout
android:id="#+id/ll_d"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioGroup
android:id="#+id/rg_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rb_direct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:hint="direction"
android:text="direct" />
<RadioButton
android:id="#+id/rb_inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="inverse" />
</RadioGroup>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" >
<!--
<Button
android:id="#+id/btn_get_from_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BT"
android:textColor="#color/blue" />
-->
<Button
android:id="#+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text="#string/delete" />
<ImageButton
android:id="#+id/ib_disto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="#drawable/back02" />
<Button
android:id="#+id/btn_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="save"
android:textColor="#color/green" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_e"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/et_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/description" >
<requestFocus />
</EditText>
</LinearLayout>
The reason for disappearing of the EditText is that you want to display items, which has total width greater than the width of the screen, so I've applied same layout_weight:"1" to all the elements inside the LinearLayout. May be this helps you for solving your issue.
I have two buttons Login and Scan. I want these buttons to be in a horizontal way just like in a single row. I tied making the layout horizontal. However it does not work. They should appear side by side. My code is as follows.
<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:background="#drawable/imagesand"
android:orientation="vertical"
tools:context=".MainActivity" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/imagesand"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="207dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="#drawable/loginbg"
android:gravity="center"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="User Name"
android:textAppearance="#android:style/TextAppearance.Medium" />
<EditText
android:id="#+id/emailid"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"
android:background="#drawable/button"
android:hint="User Name"
android:inputType="text"
android:paddingLeft="10dp"
android:textAppearance="#android:style/TextAppearance.Medium" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Password"
android:textAppearance="#android:style/TextAppearance.Medium" />
<EditText
android:id="#+id/password"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"
android:background="#drawable/button"
android:hint="Password"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:textAppearance="#android:style/TextAppearance.Medium" />
<Button
android:id="#+id/login"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="Login"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textColor="#000000"
android:typeface="serif" />
<Button android:id="#+id/scan"
and
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="scan"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Just put both button in LinearLayout whose orientation must be horizontal
Simple use this..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:layout_weight="1"
android:text="Login"
android:textColor="#000000" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:text="Scan"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
Use this code:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/imagesand"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="207dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="#drawable/loginbg"
android:gravity="center"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="User Name"
android:textAppearance="#android:style/TextAppearance.Medium" />
<EditText
android:id="#+id/emailid"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"
android:background="#drawable/button"
android:hint="User Name"
android:inputType="text"
android:paddingLeft="10dp"
android:textAppearance="#android:style/TextAppearance.Medium" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Password"
android:textAppearance="#android:style/TextAppearance.Medium" />
<EditText
android:id="#+id/password"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"
android:background="#drawable/button"
android:hint="Password"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:textAppearance="#android:style/TextAppearance.Medium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
<Button
android:id="#+id/login"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="Login"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textColor="#000000"
android:typeface="serif" />
<Button android:id="#+id/scan"
and
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="scan"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
You can either wrap the buttons within a horizontal LinearLayout like this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/login"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="Login"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textColor="#000000"
android:typeface="serif" />
<Button android:id="#+id/scan"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="scan"/>
</LinearLayout>
or use a RelativeLayout.
RealtiveLayout is the best choice:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="#+id/button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/entry"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/space"
/>
<TextView
android:id="#id/space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"/>
<Button
android:id="#+id/button02"
android:layout_toRightOf="#id/button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/entry"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
Seems like you want two equal buttons, not wrapped content. I created a centered spacer using TextView, and relatively aligned to that. Left button to parent left and spacer, Right button to Left Button and parent right.
This should works:
Change these,
<Button
android:id="#+id/login"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="Login"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textColor="#000000"
android:typeface="serif" />
<Button android:id="#+id/scan"
and
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="scan"/>
with this,
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/login"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="Login"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textColor="#000000"
android:typeface="serif" />
<Button
android:id="#+id/scan"
android:layout_width="71dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="#drawable/login"
android:text="scan" />
</LinearLayout>