I am trying to create an interface that is a tabbed view. my form is in one tab and the results will be in another tab. I am having difficulty in getting the form to scroll down so that I can access the data off screen. Tab1 below is the content I want to be scrollable. Am I using the wrong type of container to hold my form and that is why I cannot scroll it down as I enter data into my form fields? Can you offer any suggestions as to what I am missing or doing wrong please?
my main tab gui xml:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:isScrollContainer="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="#layout/tab1"/>
<include layout="#layout/tab2"/>
</FrameLayout>
</LinearLayout>
</TabHost>
Tab1 -- this is where I want the content to be scrollable:
<?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:orientation="vertical" android:id="#layout/tab1" android:scrollbarAlwaysDrawVerticalTrack="true" android:scrollbarDefaultDelayBeforeFade="3" android:scrollbarFadeDuration="2" android:scrollbars="vertical" android:isScrollContainer="true">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_fn" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:inputType="text"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_ln" />
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:inputType="text">
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_ssn" />
<EditText
android:id="#+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number" android:maxLength="9999"/>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_phone" />
<EditText
android:id="#+id/editText4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_class" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="#string/search_class_all"/>
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_class_comm"/>
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_class_med"/>
</RadioGroup>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_status" />
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
<RadioButton
android:id="#+id/radio3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="#string/search_status_all" />
<RadioButton
android:id="#+id/radio4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_status_avail" />
<RadioButton
android:id="#+id/radio5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/search_status_emp" />
</RadioGroup>
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/view1" />
</LinearLayout>
tab2 -- once the search is complete the results will be displayed here.:
<?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:orientation="vertical" android:id="#layout/tab2">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/view2" />
</LinearLayout>
For the tab you want to scroll, you need to use <ScrollView> instead of <LinearLayout>. Or, create the <ScrollView> as the first item in your <LinearLayout>, and then all your scrollable content goes inside the <ScrollView>.
For example...
<?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:orientation="vertical" android:id="#layout/tab1">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<TextView>...
<EditText>...
<OtherObjects>...
</ScrollView>
</LinearLayout>
Related
hello AdMob banner ads not showing up any more after I add ScrollView I don't know why I tried many time but nothing
before added ScrollView is was working well
I have tried many methods to put in bottom the layout but not working with me
plz if you can help me I want to I want to place the ad on the bottom I have a LinearLayout. When I do it never shows up
<Toolbar
android:id="#+id/mytoolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</Toolbar>
<ScrollView
android:layout_above="#+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:gravity="center_vertical"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip">
<TextView
android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Extreme power saving mode" />
</LinearLayout>
<Switch
android:id="#+id/setSwitch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10.0dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/ad_banner">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
I looked into your code. Wrap your layout in relative. Layout below and above only works in relative not in linear, and remove the two linear layout below that is wrapping the adView.
This should work
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:orientation="vertical"
android:background="#fff1f1f1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<Toolbar
android:id="#+id/mytoolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</Toolbar>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/mytoolbar"
android:layout_above="#+id/adView">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:gravity="center_vertical"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip">
<TextView
android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Extreme power saving mode" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3.0dip"
android:text="The disadvantage is that the playback progress will be lost."
android:ems="11" />
</LinearLayout>
<Switch
android:id="#+id/setSwitch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10.0dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip">
<TextView android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Desktop control playback" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3.0dip"
android:text="Quickly click or swipe three times" />
</LinearLayout>
<Switch android:id="#+id/setSwitch2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10.0dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<TextView
android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip"
android:text="Sound" />
<Switch
android:id="#+id/setSwitch3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10.0dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/setRelativeLayout1"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip">
<TextView
android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Compatibility mode" />
<TextView
android:id="#+id/moreTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3.0dip"
android:text="MIUI8 set as lock screen wallpaper" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/setRelativeLayout2"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<TextView
android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip"
android:text="Get Starry Sky Wallpaper" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlRate"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<TextView android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip"
android:text="rate us " />
</RelativeLayout>
<RelativeLayout android:id="#+id/setRelativeLayout3"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip">
<TextView android:textSize="17.0sp"
android:textColor="#ff000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15.0dip"
android:text="Close wallpaper" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/ad_banner">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
I use scrollView in my project. There are some questions in textview and answers of question in radioButton. I should add horizontal scrollBar to this layout to show more questions in Activity. But scrollview doesn't work. Also I can't add scrollBar there, that seem doesn't work. I just looked some questions in StackOverflow. According them my codes should work. But it doesn't work. Please help me.
job_security.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="#+id/radio_layout"
android:layout_width="match_parent"
android:layout_height="222dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<TextView
android:id="#+id/textView4"
android:layout_width="360dp"
android:layout_height="26dp"
android:layout_marginTop="20dp"
android:text="#string/job_security_question1"
android:textSize="16sp" />
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/job_security_question1.2"
android:textSize="12sp" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/rd1_yes"
android:layout_width="190dp"
android:layout_height="match_parent"
android:buttonTint="#color/colorPrimary"
android:gravity="left|center_vertical"
android:text="#string/radio_yes" />
<RadioButton
android:id="#+id/rd1_no"
android:layout_width="190dp"
android:layout_height="match_parent"
android:buttonTint="#color/colorPrimary"
android:text="#string/radio_no" />
</RadioGroup>
<TextView
android:id="#+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/job_security_question2" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/rd2_yes"
android:layout_width="190dp"
android:layout_height="match_parent"
android:buttonTint="#color/colorPrimary"
android:gravity="left|center_vertical"
android:text="#string/radio_yes" />
<RadioButton
android:id="#+id/rd2_no"
android:layout_width="190dp"
android:layout_height="match_parent"
android:buttonTint="#color/colorPrimary"
android:text="#string/radio_no" />
</RadioGroup>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<Button
android:id="#+id/btn_login"
style="?android:attr/buttonStyleSmall"
android:layout_width="178dp"
android:layout_height="40dip"
android:layout_centerHorizontal="true"
android:background="#drawable/buton_radious"
android:clickable="true"
android:focusable="true"
android:text="#string/send_button"
android:textColor="#android:color/white"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
Inside ScrollView must contain only one layout!
This sample code solve your problem
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- here add your views -->
</LinearLayout>
</ScrollView>
I have a layout, in which I need that the top header should should not hide when I open softKeyBoard. I am using Fragment here.I am using recylerView.
when i am opening softkeyboard the top header is scrolling up. I need that header to stay there and Recyclerview to scroll.
Below is my xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rel_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bggradient">
<RelativeLayout
android:id="#+id/rel_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/drawable_below_line">
<ImageView
android:id="#+id/iv_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtSettingHeader"
android:layout_alignTop="#+id/txtSettingHeader"
android:layout_centerVertical="true"
android:background="#drawable/button_selector"
android:onClick="onClickEvent"
android:padding="10dp"
android:src="#mipmap/ic_back" />
<TextView
android:id="#+id/txtUserName"
style="#style/FragHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/iv_userImage"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtUserName"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/txtUserName"
android:layout_centerVertical="true"
android:onClick="onViewClick"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="#mipmap/ic_male" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/lin_comment"
android:layout_below="#+id/rel_header"
android:gravity="top"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/RecyelerViewChat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
</android.support.v7.widget.RecyclerView>
<TextView
android:id="#+id/tv_txtNoRecords"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:minHeight="100dp"
android:text="#string/txtNoChat"
android:textColor="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/lin_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#70FFFFFF"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp">
<LinearLayout
android:id="#+id/linEditComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:focusableInTouchMode="true"
android:orientation="horizontal">
<ImageView
android:id="#+id/iv_imgToggleKeyboardEmoji"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:src="#mipmap/ic_emoji" />
<com.lawo.emojicon.EmojiconEditText
android:id="#+id/et_edtChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/drawable_black_border"
android:hint="#string/hintTypeMessage"
android:inputType="textNoSuggestions|textMultiLine"
android:maxLength="500"
android:maxLines="3"
android:padding="10dp"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray" />
</LinearLayout>
<ImageView
android:id="#+id/iv_imgSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="onClickEvent"
android:padding="10dp"
android:src="#mipmap/ic_sent" />
</LinearLayout>
</RelativeLayout>
Add the following to your "activity" tag in AndroidManifest.xml:
android:windowSoftInputMode="adjustResize"
Reference: Specify How Your UI Should Respond.
i created button and other...
but now when i want to create a three buttons green,red,blue they are not showing up i want them to be directly down the button1 but they are not showing up i wish you can help me this is the error im getting -xml documents must start and end within the same entity the error is showing in the last last last linearlayout
this is the code im having problem with
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Greetings"
android:textSize="20sp" />
<Button
android:id="#+id/Button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/thirdLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#ff0000"
android:textColor="#000000"
android:text="red" />
<TextView
android:id="#+id/fourthLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#00ff00"
android:textColor="#000000"
android:text="green" />
<TextView
android:id="#+id/fifthLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#0000ff"
android:textColor="#000000"
android:text="blue" />
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
</LinearLayout>
this is a picture for the red blue green buttons where to be while mine are down
https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png
this is what i reached to till now but i want them to be equally distributed like the picture above
https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png
you have not closed the below linear layout tag in your xml.
"<"LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:orientation="horizontal" ">"
You need one more </LinearLayout> at the end of your xml file. At the minute, only 2 of the 3 LinearLayout's are being closed.
EDIT
The reason your Buttons are appearing at the bottom is because of this:
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
I'm not sure what purpose this serves in your application, but removing that will fix your problem.
Replace your xml with following code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="10" >
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp" />
<Button
android:id="#+id/Button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="HelloWord" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dp"
android:weightSum="10" >
<TextView
android:id="#+id/thirdLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.3"
android:background="#ff0000"
android:text="red"
android:textColor="#000000"
android:gravity="center" />
<TextView
android:id="#+id/fourthLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.4"
android:background="#00ff00"
android:text="green"
android:textColor="#000000"
android:gravity="center" />
<TextView
android:id="#+id/fifthLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.3"
android:background="#0000ff"
android:text="blue"
android:textColor="#000000"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
Hope it will help you.
I want to make quiz app. I have two Textview and one edit text.
I placed the edittext between two textview.
<?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:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/first_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:textSize="18sp" />
<EditText
android:id="#+id/first_answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/second_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:lines="6"
android:textSize="20sp" />
</LinearLayout>
<Button
android:id="#+id/btnCheckAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Check" />
</LinearLayout>
how to make text from the second textview below first textview?
I want to make the words "Nijuu sai desu. Chugoku desu." below "Watashi wa".
try
<?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:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/first_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:textSize="18sp" />
<TextView
android:id="#+id/second_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="6"
android:singleLine="false"
android:textSize="20sp" />
</LinearLayout>
<EditText
android:id="#+id/first_answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
you can try
<?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:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/first_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:textSize="18sp" />
<EditText
android:id="#+id/first_answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/second_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:lines="6"
android:textSize="20sp" />
</LinearLayout>
<Button
android:id="#+id/btnCheckAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Check" />
</LinearLayout>