Reputation: 1882
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>
Upvotes: 1
Views: 242
Reputation: 1532
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:-
Upvotes: 1
Reputation: 1645
Remove android:windowSoftInputMode="stateHidden|adjustPan"
from your menifest. I have done like this.. It is not go up.
Upvotes: 0
Reputation: 3273
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:
Upvotes: 3
Reputation: 1782
<?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>
Upvotes: 1