Im having problem while setting corner radius of imageview in homescreen widget i setted radius of bg linear using drawable file, please anyone help me i"ll add screenshots of below
[This is my manifest when i set java file for widget in manifest widget is not loading, if anyone know why leave a comment for this too but, my main question is imageview radius]
<receiver android:name=".WidgetMusicProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info" />
</receiver>
[This is the widget xml still no java has been used in widget]
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:orientation="horizontal"
android:padding="0dp" >
<LinearLayout
android:id="#+id/main_lin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="#xml/widget_style"
android:outlineProvider="background"
android:padding="0dp" >
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:outlineProvider="background"
android:scaleType="centerCrop"
android:src="#drawable/Sundari" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/font"
android:text="Titles goes here"
android:textColor="#000000"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/font"
android:text="Artist goes here"
android:textColor="#757575"
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="0dp" >
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:padding="0dp"
android:src="#drawable/noti_prev" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:padding="0dp"
android:src="#drawable/noti_play" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:padding="0dp"
android:src="#drawable/noti_next" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
[This is the java file i tried to set but when setted from manifest its not showing widget even if the java file is empty so problem is not in java file]
#Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_music);
rv.setBoolean(R.id.main_lin, "setClipToOutline", true);
appWidgetManager.updateAppWidget(appWidgetId, rv);
}
}
}
This is the widget
I tried android:clipToOutline cardview but when use cardview its not showing widget in homescreen its showing (problem loading widget) im expecting to fix this soon
Related
I know this question has been on the internet for ages, but nothing seems to work in my case.
What's wrong
As seen in screenshots, the layout having the spinner is not pushed up and is overlapped by the soft keyboard. I want this layout to be placed just above the keyboard when it pops up.
My layout file
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical"
tools:context="believe.cht.speak.MainActivity">
<ImageView
android:id="#+id/logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:layout_margin="16dp"
android:src="#drawable/ic_bubble"
android:tint="#color/blue" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:gravity="top|start"
android:hint="Start typing..."
android:padding="8dp" />
<ImageView
android:id="#+id/shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:src="#drawable/shadow" />
<RelativeLayout
android:id="#+id/spinnerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#color/blue">
<Spinner
android:id="#+id/spinner"
android:layout_width="200dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
What I've tried
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustPan" //in the manifest, also tried combining the two
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); //in the activity
<item name="android:windowActionBarOverlay">true</item> //in styles.xml
Try this
<?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="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical">
<ImageView
android:id="#+id/logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:layout_margin="16dp"
android:src="#drawable/ic_message" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:gravity="top|start"
android:hint="Start typing..."
android:padding="8dp" />
<ImageView
android:id="#+id/shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:src="#drawable/ic_camera" />
<RelativeLayout
android:id="#+id/spinnerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#color/colorPrimary">
<Spinner
android:id="#+id/spinner"
android:layout_width="200dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Manifest file
<activity android:name=".MyActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
OUTPUT
Adding to Nilesh's answer above, even though the code worked, it didn't work with my Java class. The reason was that I was hiding the statusbar with
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Using the code provided and leaving the statusbar untouched did the job. Don't know why. I would be helpful if anyone could explain this.
Try using a RelativeLayout instead of LinearLayout and add android:alignParentBottom="true" to your spinnerLayout
I don't know how to get my soft keyboard to show up under an TextView Field. It just covers up my Button and TextView.
I have used this link http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
as a reference. But it isn't working.
I have windowSoftInputMode="adjustPan" in the AndroidManifest file for my activity
<activity
android:name=".SearchView"
android:label="#string/title_activity_search_view"
android:parentActivityName=".MainActivity"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.txisystems.inventory.MainActivity" />
</activity>
Here is what the screen looks like without the soft keyboard.
and the code to go with it.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.mycompany.inventory.SearchView"
tools:showIn="#layout/activity_search_view">
<ImageView
android:id="#+id/logoView"
android:layout_width="225dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:src="#drawable/mylogo" />
<ProgressBar
android:id="#+id/progressBar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/logoView"
android:layout_centerHorizontal="true"
android:visibility="invisible" />
<EditText
android:id="#+id/txtSearchField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/logoView"
android:layout_alignLeft="#+id/logoView"
android:layout_alignRight="#+id/logoView"
android:layout_alignStart="#+id/logoView"
android:layout_below="#+id/progressBar2"
android:inputType="textShortMessage"
android:maxLength="17"
android:maxLines="1"
android:capitalize="none" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtSearchField"
android:layout_marginBottom="15dp"
android:layout_marginTop="10dp"
android:background="#color/colorPrimary"
android:backgroundTint="#color/colorPrimaryDark"
android:onClick="doSearch"
android:text="Search"
android:textColor="#color/buttontext" />
<TextView
android:id="#+id/lblSearchMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/button"
android:layout_alignLeft="#+id/button"
android:layout_alignRight="#+id/button"
android:layout_alignStart="#+id/button"
android:layout_below="#+id/button"
android:gravity="center_horizontal"
android:text="Please enter 4 or more characters."
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/error"
android:textStyle="bold" />
</RelativeLayout>
Here is what happens (I used Photoshop to simulate the screen.)
The keyboard can't be dismissed and it covers the button and the message area.
And here is what I want to happen through the magic of Photoshop.
Use this in the Activity (OnCreate) which hosts the XML:
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
I build two XML-files for my activity. One in the layout Folder and the other in the layout-land folder. But when I change the orientation from portrait to landscape mode the activity relaunches. And thats exactly what i not want.
Because I'm plotting in three Graphs realtime data and the plotting should continue when I turn the Screen and not being interrupted or start new in any way.
Here is the first XML file in the layout-land Folder:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="496dp"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:id="#+id/my_layout" >
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Feuchtigkeit"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_alignLeft="#+id/sensor1_graph_Druck"
android:layout_alignParentTop="true" />
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Temperatur"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_alignLeft="#+id/sensor1_graph_Feuchtigkeit"
android:layout_below="#+id/sensor1_graph_Feuchtigkeit"
android:layout_marginTop="8dp" />
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Druck"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_below="#+id/sensor1_graph_Temperatur"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp" />
<Switch
android:id="#+id/mySwitch"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/sensor1_graph_Druck"
android:layout_centerHorizontal="false"
android:layout_marginTop="8dp"
/>
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/switchStatus"
android:layout_alignParentBottom="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/switchStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/mySwitch"
android:layout_alignBottom="#+id/mySwitch"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/mySwitch"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignLeft="#+id/mySwitch"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</ScrollView>
And here the second one in layout Folder:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="496dp"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:id="#+id/my_layout" >
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Feuchtigkeit"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_alignLeft="#+id/sensor1_graph_Druck"
android:layout_alignParentTop="true" />
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Temperatur"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_alignLeft="#+id/sensor1_graph_Feuchtigkeit"
android:layout_below="#+id/sensor1_graph_Feuchtigkeit"
android:layout_marginTop="8dp" />
<com.jjoe64.graphview.GraphView
android:id="#+id/sensor1_graph_Druck"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_below="#+id/sensor1_graph_Temperatur"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp" />
<Switch
android:id="#+id/mySwitch"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/sensor1_graph_Druck"
android:layout_centerHorizontal="false"
android:layout_marginTop="8dp"
/>
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/switchStatus"
android:layout_alignParentBottom="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/switchStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/mySwitch"
android:layout_alignBottom="#+id/mySwitch"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/mySwitch"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignLeft="#+id/mySwitch"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</ScrollView>
In the Manifest XML it Looks like this:
<activity
android:name="com.TomKun.testgraph.DruckActivity"
android:label="#string/Sensor_1"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden">
</activity>
If i have Manifest like this with
android:configChanges="orientation|screenSize|keyboard|keyboardHidden">
</activity>
Then the layout does not change when I switch from Portrait to landscape mode. BUT the activity does not relaunch. Thats the one good thing
But if I do NOT use
android:configChanges="orientation|screenSize|keyboard|keyboardHidden">
</activity>
the layout changes as i want but the activity is then relaunching.
So something in my implementation doesn't match.
Can anyone help me to solve this Problem?
I have seen that many people have similar Problems here on stackoverflow. But with these answers I couldn't solve my problem
Thanks in Advance!
I have the following XML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rlDateOne"
android:background="#drawable/dateborder"
android:padding="#dimen/date_layout_pad" >
<ImageView
android:id="#+id/ivIcon"
android:layout_width="#dimen/cal_icon_size"
android:layout_height="#dimen/cal_icon_size"
android:src="#drawable/calicon" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/ivIcon"
android:layout_toRightOf="#+id/ivIcon"
android:text="#string/date_one"
android:layout_marginLeft="#dimen/cal_text_left_margin"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
<TextView
android:id="#+id/tvReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ivIcon"
android:layout_alignLeft="#+id/tvDate"
android:text="#string/holiday_one"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
</RelativeLayout>
<ImageView
android:id="#+id/ivCal"
android:layout_width="fill_parent"
android:layout_height="#dimen/divider_height"
android:src="#drawable/divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rlDateOne"
android:background="#drawable/dateborder"
android:padding="#dimen/date_layout_pad" >
<ImageView
android:id="#+id/ivIcon"
android:layout_width="#dimen/cal_icon_size"
android:layout_height="#dimen/cal_icon_size"
android:src="#drawable/calicon" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/ivIcon"
android:layout_toRightOf="#+id/ivIcon"
android:text="#string/date_two"
android:layout_marginLeft="#dimen/cal_text_left_margin"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
<TextView
android:id="#+id/tvReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ivIcon"
android:layout_alignLeft="#+id/tvDate"
android:text="#string/holiday_two"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
</RelativeLayout>
<ImageView
android:id="#+id/ivCal"
android:layout_width="fill_parent"
android:layout_height="#dimen/divider_height"
android:src="#drawable/divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rlDateOne"
android:background="#drawable/dateborder"
android:padding="#dimen/date_layout_pad" >
<ImageView
android:id="#+id/ivIcon"
android:layout_width="#dimen/cal_icon_size"
android:layout_height="#dimen/cal_icon_size"
android:src="#drawable/calicon" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/ivIcon"
android:layout_toRightOf="#+id/ivIcon"
android:text="#string/date_three"
android:layout_marginLeft="#dimen/cal_text_left_margin"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
<TextView
android:id="#+id/tvReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ivIcon"
android:layout_alignLeft="#+id/tvDate"
android:text="#string/holiday_three"
android:textSize="#dimen/cal_text_size"
android:textColor="#color/dateholiday" />
</RelativeLayout>
</LinearLayout>
As you can see above, there is a repeat of the same code (From ImageView to </RelativeLayout> and this is just an example. I have to repeat it 41 times, instead of 3 that is shown here.
Instead of using XML how do I add it programmatically (Let's say tvDate and tvReason are String arrays)?
Is it recommended to just use XML or add it in Java?
You can make separated xml file and inflate views (any quantity) when ever you need:
...
public void onCreate(Bundle b){
super(b);
setContentView(R.layout.your_activity_layout);
...
View yourView = getLayoutInflater().inflate(R.layout.your_xml_file, null);
yourBasicLayout.addView(yourView);
...
}
Create a ListView where every item has the repeating layout. In that way you can repeat it as many times as you like.
I have an android layout made like this:
--------------
| IMAGE1 |
--------------
| SCROLLVIEW |
--------------
| IMAGE2 |
--------------
When the keyboard pops up to input text in the scrollview's edittext, it resizes the whole application. Is there any way to keep IMAGE2 at the bottom of the screen?
The layout of the application:
<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"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignupActivity" >
<ImageView
android:id="#+id/Logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp"
android:src="#drawable/logo_1" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:scaleType="centerCrop"
android:src="#drawable/wave_2" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Logo" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="286dp"
android:fadingEdge="none"
android:orientation="vertical"
android:paddingBottom="30dp" >
<EditText
android:id="#+id/editName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/name" />
<EditText
android:id="#+id/editSurname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/surname" />
<EditText
android:id="#+id/editCompany"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/company" />
<Space
android:layout_width="match_parent"
android:layout_height="20dp" />
<EditText
android:id="#+id/editUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/username" />
<EditText
android:id="#+id/editPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/password"
android:inputType="textPassword" />
<EditText
android:id="#+id/editMail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/mail"
android:inputType="textEmailAddress" />
<Space
android:layout_width="match_parent"
android:layout_height="20dp" />
<EditText
android:id="#+id/editAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/address" />
<EditText
android:id="#+id/editZipCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/zipcode" />
<EditText
android:id="#+id/editCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/city" />
<EditText
android:id="#+id/editCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/country" />
<EditText
android:id="#+id/editPhone1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/phone" />
<EditText
android:id="#+id/editPhone2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:hint="#string/mobilephone" />
<Space
android:layout_width="match_parent"
android:layout_height="20dp" />
<Button
android:id="#+id/acceptButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="signup"
android:layout_gravity="center_horizontal"
android:text="#string/register" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Edit:
This is how actually the layout is. I want to keep the green wave image at the end of the page (under the keyboard) while still resizing the ScrollView to make it usable.
http://i.stack.imgur.com/ji1FB.png
http://i.stack.imgur.com/D4jcX.png
add this lines in your manifest in activity tag may be this works
<activity
android:name=".DemoActivity"
android:windowSoftInputMode="stateHidden|adjustResize" >
</activity>
If you want your IMAGE2 stuck at the bottom of the screen, put below code inside your activity tag in manifest.xml
<activity
.
.
android:windowSoftInputMode="adjustPan" >
</activity>
EDIT:
Try to put below tag along with the above mentioned one
android:windowSoftInputMode="stateVisible|adjustResize"
Let me know if this one works for you.
The problem is that your Button is part of the ScrollView. You should pull your Button out of the ScrollView and into the parent RelativeLayout, changing the attributes as follows:
<Button
android:id="#+id/acceptButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" //keep it to the bottom of the layout
android:onClick="signup"
android:layout_gravity="center_horizontal"
android:text="#string/register" />
Then your ScrollView will also need a modification:
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Logo"
android:layout_above="#+id/acceptButton" //make it stay above the button
>
And given that you are using android:windowSoftInputMode="adjustResize", this should give you the correct behavior.
EDIT: Wait, if you just want the background to stay positioned, try just setting that image as your windowBackground in your Activity theme. (e.g. add android:windowBackground="#drawable/my_background_image" to the theme that your Activity uses).