ViewFliper in layout - android

i am doing one application in android but i have one problem in layout file
i am doing by viewFliper
here is code
<?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:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/Quesiontext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="44dp"
android:text="#string/Question"
android:textSize="18sp" />
<RadioGroup
android:id="#+id/radioGroupOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Quesiontext"
android:layout_marginTop="30dp" >
<RadioButton
android:id="#+id/optionOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="#string/option1" />
<RadioButton
android:id="#+id/optionTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option2" />
<RadioButton
android:id="#+id/optionthree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option3" />
<RadioButton
android:id="#+id/optionFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option4" />
</RadioGroup>
<TextView
android:id="#+id/corrertView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroupOptions"
android:layout_marginRight="48dp"
android:text="#string/correct" />
<Button
android:id="#+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/corrertView"
android:layout_below="#+id/corrertView"
android:layout_marginTop="42dp"
android:text="#string/Next"
android:textSize="16sp" />
<Button
android:id="#+id/Btnpervious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/btnNext"
android:layout_alignBottom="#+id/btnNext"
android:layout_alignParentLeft="true"
android:text="#string/Pervious"
android:textSize="16sp" />
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ViewFlipper
android:id="#+id/ViewFlipper01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/Quesiontext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="44dp"
android:text="#string/Question"
android:textSize="18sp" />
<RadioGroup
android:id="#+id/radioGroupOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Quesiontext"
android:layout_marginTop="30dp" >
<RadioButton
android:id="#+id/optionOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="#string/option1" />
<RadioButton
android:id="#+id/optionTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option2" />
<RadioButton
android:id="#+id/optionthree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option3" />
<RadioButton
android:id="#+id/optionFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option4" />
</RadioGroup>
<TextView
android:id="#+id/corrertView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroupOptions"
android:layout_marginRight="48dp"
android:text="#string/correct" />
</ViewFlipper>
</RelativeLayout>
</RelativeLayout>
i didnt get it that how i put another button into ViewFliper ..its confusion and generating error...

You haven't closed your ViewFlipper with </ViewFlipper>

Could this be what you are looking for,
android:id="#+id/layout"
You missed a "+" symbol while creating a id.

Related

My app front page is not showing anything except the heading

The Following Code is From MainActivity.xml file
Only the Heading "G.K. Quiz" is appearing on the app.
It's just the same 10 questions with 3 radiobutton options to choose from and all this inside a ScrollView Linear Layout. I don't understand what the problem is. I'm new to android coding. Is it something to do with the ScrollView?? ThankYou in Advance.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.example.android.generalquiz.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:fontFamily="casual"
android:text="#string/quiz"
android:textAlignment="center"
android:textSize="30sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="#string/first"
android:textSize="18sp" />
<RadioButton
android:id="#+id/ans1"
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/largest" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/longest" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/none" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="#string/second"
android:textSize="18sp" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/seconda" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/secondb" />
<RadioButton
android:id="#+id/ans2"
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/secondc" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="#string/third"
android:textSize="18sp" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/thirda" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/thirdb" />
<RadioButton
android:id="#+id/ans3"
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/thirdc" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="#string/fourth"
android:textSize="18sp" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fourtha" />
<RadioButton
android:id="#+id/ans4"
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fourthb" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fourthc" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="#string/fifth"
android:textSize="18sp" />
<RadioButton
android:id="#+id/ans5"
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fiftha" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fifthb" />
<RadioButton
style="#style/margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fifthc" />
</LinearLayout>
</ScrollView>
This is how it looks

how to allow only one radiobtton to be executed in a radiogroup inside a linear layout?

I am trying to place a radio group with 3 radio buttons inside a linear layout. My aim is to choose only one RadioButton inside the RadioGroup but, it is giving me an error that there are multiple root tags. Can someone figure out how to solve this?
file.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ok"
android:id="#+id/textemail"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:id="#+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one" />
<RadioButton
android:id="#+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="two"
/>
<RadioButton
android:id="#+id/three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three" />
</RadioGroup>
<TextView
android:id="#+id/textView1"
android:layout_below="#+id/textemail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To:"
/>
<TextView
android:id="#+id/TextTo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="khushi"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comment:"
/>
<TextView
android:id="#+id/TextS3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="your comment"
/>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="email us "
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:lines="10" />
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send"
android:textStyle="italic"/>
</LinearLayout>
You immediately close your radiogroup:
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"/>
This should be:
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"> // Note that there is no forward slash at the end
And you are not closing the RadioGroup:
</RadioButton> <-- This should be </RadioGroup>
Your RadioButton (views) should be children of the RadioGroup(view). By closing your RadioGroup using /> you declare the RadioButton(s) and the RadioGroup as children of the LinearLayout.
The Following should work.
<?xml version="1.0" encoding="utf-8"?>
<Linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="hello"
android:id="#+id/textview"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:id="#+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one" />
<RadioButton
android:id="#+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="two"
/>
<RadioButton
android:id="#+id/three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three" />
</RadioButton>
</RadioGroup>
<TextView
android:id="#+id/textViewllol"
android:layout_below="#+id/textemail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi:"
/>
<TextView
android:id="#+id/Texme"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="comment:"
/>
<TextView
android:id="#+id/Text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="your comments"
/>
<TextView
android:id="#+id/textView45"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok"
/>
<EditText
android:id="#+id/editTextMessage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:lines="10" />
<Button
android:id="#+id/button4785"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="send"
/>
</LinearLayout>
Change below -
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"/>
to
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:id="#+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one" />
<RadioButton
android:id="#+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="two"
/>
<RadioButton
android:id="#+id/three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three" />
</RadioGroup>
One of your Text is not in correct format change it as below -
<TextView
android:id="#+id/textView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok:"
/>
to
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok:"
/>
One more error -
change below -
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
to
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
You have one </Radiobutton> tag above </Radiogroup> that shouldn't be here. Just remove it to have :
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:id="#+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one" />
<RadioButton
android:id="#+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="two"
/>
<RadioButton
android:id="#+id/three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three" />
</RadioGroup>

Android radio button text truncated

I have an app that shows a Radio Group with four Radio Buttons whose test is set dynamically. I am no able to get the whole text on a single line.
It gets wrapped on two lines, or truncated at the end. It seems like there is a vertical edge, and text cannot go over it.
My layout is
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="vds.quizmanager.QuizManagerActivity" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp"
android:text="Domanda:" />
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_marginTop="24dp"
android:layout_toLeftOf="#+id/button2" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minWidth="#dimen/activity_vertical_margin" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RadioGroup>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/radioGroup1"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:text="Domanda" />
</RelativeLayout>
OK then you can try this code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp"
android:text="Domanda:" />
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="sdfsgdshfdgsasRFAGRESTDGHFSAFAWhtjygukjtyhergwrqTQETWRYJETRHEWRQEJTUKRYJTRHEAWRWetjyurrutjretwrtjyeukyriu" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="24dp"
android:layout_toLeftOf="#+id/button2" >
<RadioButton
android:id="#+id/radio0"
android:text="Domandaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minWidth="#dimen/activity_vertical_margin" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RadioGroup>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/radioGroup1"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:text="Domanda" />
</RelativeLayout>
This is result:

relative layout bottom buttons goes up

I have a relative layout with scrollview. In My relative layout i have few image buttons and radio group when i select the radio option the bottom image view android:id="#+id/sol_btn
goes up.
Why its goes up? what mistake in my layout? And in my manifest also i have used this
android:windowSoftInputMode="stateHidden|adjustPan"
My layout code here:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".Quesans">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/que_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="25dp"
android:text="TextView" />
<ImageView
android:id="#+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/que_txt"
android:layout_marginTop="15dp"
android:layout_marginBottom="40dp"
android:layout_below="#+id/que_txt"/>
<RadioGroup
android:id="#+id/rdgroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image"
android:orientation="vertical" >
<RadioButton
android:id="#+id/RB1"
android:text=""/>
<RadioButton
android:id="#+id/RB2"
android:text=""/>
<RadioButton
android:id="#+id/RB3"
android:text=""/>
<RadioButton
android:id="#+id/RB4"
android:text=""/>
</RadioGroup>
<TextView
android:id="#+id/rdtxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/rdgroup"
android:layout_marginTop="40dp"
android:text="Nothing is picked"
android:textColor="#0000FF"/>
<ImageView
android:id="#+id/nxt_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/rdtxt"
android:layout_marginRight="22dp"
android:layout_marginTop="40dp"
android:src="#drawable/next_pressed" />
<ImageView
android:id="#+id/focusarea"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/nxt_btn"
android:layout_below="#+id/nxt_btn"
android:layout_marginRight="1dp"
android:layout_marginTop="10dp"
android:src="#drawable/focusarea_pressed" />
<ImageView
android:id="#+id/app"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="140dp"
android:layout_marginBottom="0dp"
android:src="#drawable/newapps" />
<ImageView
android:id="#+id/prv_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/image"
android:layout_alignTop="#+id/nxt_btn"
android:src="#drawable/previous_pressed" />
<ImageView
android:id="#+id/sol_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/prv_btn"
android:layout_below="#+id/prv_btn"
android:layout_marginTop="10dp"
android:layout_marginLeft="1dp"
android:src="#drawable/solution_pressed" />
</RelativeLayout>
</ScrollView>
I have changed images to default. Edit xml file and try this,it will work fine.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/que_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="25dp"
android:text="TextView" />
<ImageView
android:id="#+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/que_txt"
android:layout_below="#+id/que_txt"
android:layout_marginBottom="40dp"
android:layout_marginTop="15dp"
android:background="#drawable/ic_launcher" />
<RadioGroup
android:id="#+id/rdgroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image"
android:orientation="vertical" >
<RadioButton
android:id="#+id/RB1"
android:text="" />
<RadioButton
android:id="#+id/RB2"
android:text="" />
<RadioButton
android:id="#+id/RB3"
android:text="" />
<RadioButton
android:id="#+id/RB4"
android:text="" />
</RadioGroup>
<TextView
android:id="#+id/rdtxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/rdgroup"
android:layout_marginTop="40dp"
android:text="Nothing is picked"
android:textColor="#0000FF" />
<ImageView
android:id="#+id/focusarea"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/nxt_btn"
android:layout_below="#+id/nxt_btn"
android:layout_marginRight="1dp"
android:layout_marginTop="10dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/sol_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/prv_btn"
android:layout_below="#+id/prv_btn"
android:layout_marginLeft="1dp"
android:layout_alignParentBottom="true"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/prv_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/image"
android:layout_below="#+id/rdtxt"
android:layout_marginTop="18dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/nxt_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/prv_btn"
android:layout_marginRight="18dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/app"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:baselineAlignBottom="true"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</ScrollView>
Here is screenshot:
Your Solution Button(#+id/sol_btn) having Margin 10 dp to the previous button(#+id/prv_btn).,
So For the First question since the previous button will not be in the view your Solution button is going to the top of the view.
So Make the visibility of the previous button from View.Gone to View.Invisible.
Your problem will be solved:-
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".Quesans">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/que_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="25dp"
android:text="TextView" />
<ImageView
android:id="#+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/que_txt"
android:layout_marginTop="15dp"
android:layout_marginBottom="40dp"
android:layout_below="#+id/que_txt"/>
<RadioGroup
android:id="#+id/rdgroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image"
android:orientation="vertical" >
<RadioButton
android:id="#+id/RB1"
android:text=""/>
<RadioButton
android:id="#+id/RB2"
android:text=""/>
<RadioButton
android:id="#+id/RB3"
android:text=""/>
<RadioButton
android:id="#+id/RB4"
android:text=""/>
</RadioGroup>
<TextView
android:id="#+id/rdtxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/rdgroup"
android:layout_marginTop="40dp"
android:text="Nothing is picked"
android:textColor="#0000FF"/>
<ImageView
android:id="#+id/nxt_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/rdtxt"
android:layout_marginRight="22dp"
android:layout_marginTop="40dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/focusarea"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/nxt_btn"
android:layout_below="#+id/nxt_btn"
android:layout_marginRight="1dp"
android:layout_marginTop="10dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/app"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="140dp"
android:layout_marginBottom="0dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/prv_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/image"
android:layout_alignTop="#+id/nxt_btn"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/sol_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/prv_btn"
android:layout_below="#+id/prv_btn"
android:layout_marginTop="10dp"
android:layout_marginLeft="1dp"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</ScrollView>
Try setting android:focusable=false on your RadioGroup
Remove android:windowSoftInputMode="stateHidden|adjustPan" from your menifest. I have done like this.. It is not go up.

How to scroll in android LinearLayout?

Hi i have an application, where i want to use scroll option in liner layout. Please help me i am stuck.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
>
<AnalogClock android:id="#+id/clock1" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton android:id="#+id/rssbtn" android:src="#drawable/rss"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ProgressBar android:id="#+id/progress"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<RadioGroup android:id="#+id/widget1" android:layout_width="wrap_content"
android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<RadioButton android:id="#+id/widget2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Plain" android:checked="false" android:layout_gravity="left"
android:layout_weight="0">
</RadioButton>
<RadioButton android:id="#+id/widget3"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Serif" android:checked="true" android:layout_gravity="left"
android:layout_weight="0" android:typeface="serif">
</RadioButton>
<RadioButton android:id="#+id/widget25"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Bold" android:checked="false" android:layout_weight="0"
android:layout_gravity="left" android:textStyle="bold">
</RadioButton>
</RadioGroup>
<Spinner android:id="#+id/widget1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:drawSelectorOnTop="false" />
<TimePicker android:id="#+id/widget3" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox android:id="#+id/plain_cb" android:text="Plain"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<CheckBox android:id="#+id/serif_cb" android:text="Serif"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:typeface="serif" />
<CheckBox android:id="#+id/bold_cb" android:text="Bold"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" />
<CheckBox android:id="#+id/italic_cb" android:text="Italic"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="italic" />
<Button android:id="#+id/button1" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
<Button android:id="#+id/button2" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:typeface="serif" />
<Button android:id="#+id/button3" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:textStyle="italic" />
<DatePicker android:id="#+id/datepicker"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<EditText android:id="#+id/edittext1" android:text="EditText 1"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<EditText android:id="#+id/button2" android:text="(206)555-1212"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:typeface="serif" android:phoneNumber="true" />
<EditText android:id="#+id/password" android:text="SuperSecret"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:password="true" />
</LinearLayout>
Wrap your LinearLayout in a ScrollView at the top of the file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent">
<LinearLayout
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
>
.....
</LinearLayout>
</ScrollView>

Categories

Resources