Search code examples
androidviewflipper

ViewFliper in layout


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...


Solution

  • Could this be what you are looking for,

    android:id="@+id/layout"  
    

    You missed a "+" symbol while creating a id.