android Window Soft Input Mode - java

In my app, I need to use EditText. But i have a problem with it. On some firmwares (Ice cream sandwich for example) when user click on edittext, keyboard pushes whole screen up! I want to turn it off.
I tried to add android:windowSoftInputMode="adjustResize". Nothing changed.
Help me please.

try
android:windowSoftInputMode="adjustPan"
That perfect work for you.

Add this in your AndroidManifest.xml
android:windowSoftInputMode="stateHidden"
Perfectly works for me. You try this one.

Related

How to get smooth transition when changing activities

I am still kinda new in android development and I can not figure out how can I get smooth transition when switching between activities. I currently have this
You can try these two option.
In the intent you use to switch to another activity add this flag
Intent.FLAG_ACTIVITY_NO_ANIMATION
and in the style asset of this activity (found trough the manifest)
add this line
<item name="android:windowAnimationStyle">#null</item>
Nothing worked for me. I had to change type of animation to get rid of weird flash.

Edittext text input listener

Am developing an android chat application. Everything works well but except for one thing; I want to set the visibility of a layout to gone and then set a different layout to visible when user starts typing in the edittext like the one implemented on whatsapp.
But I cant seem to figure it out.
Any help will be appreciated
Basically, what I want to do is set the visibility of a layout which contains an image button to upload image to gone and then show a layout which contains an image button to send the message or text in the edittext to visible when the user starts typing
Can you explain in detail?
Do you wan edit text to come up when keyboard is hoped up.
then use below in your manifest.
<activity
android:name=".Activityname"
android:windowSoftInputMode="adjustPan">
If not, then please explain your question in more detail
Take a look at the TextChangedListener. With help of the TextWatcher you should be able to run commands when the input changes.
Please describe in more detail, if you need further assistance.

Is there a way to disable the "keyboard-dismiss" button?

Is there a way to disable/hide this keyboard-dismiss button and keep the soft-keyboard open?
I want to have the default back-button there and when that button is pressed it should finish() my activity without having to dismiss the keyboard first.
I have tried this: android:windowSoftInputMode="adjustResize|stateAlwaysVisible" in my manifest file, but that didn't do what I expected.
I decided that I shouldn't mess with the Android standard meaning and I have chosen to let the users dismiss the keyboard if they wish to.
Use the android:windowSoftInputMode="stateHidden" in your activity in manifest file. This will work.

How to change orientation using a menu button?

I would like to handle the orientation change of my app with a menu button, so it doesn't change views when the device is turned, but when the user presses a menu item. Can you tell me the best way to do this? Everything that comes to my mind seems to be stupid.
Thanks a lot!
You can call setRequestedOrientation so specify an orientation.
In your xml-Manifest file you can specify a android:screenOrientation="portrait" to not change the orientation automatically.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

problem while changing the orientation in app

i have already posted my issue in SO and got an answer but i have a problem in that too
my former question is
"i have created a quiz game in my app. The game is to be played in portrait mode. After the game gets over the score is been calculated and its been showed in the score page when i click ok a pop up window appears and asks for the name. I have placed an option to share the result in facebook and twitter.
now when i enter the name and click ok, a page with score name and share button appears, if i click share it moves into facebook or the other, but if i change over to landscape mobe my app gets crashed."
i got a solution to add a line in manifest file
<activity android:name=".main"
android:configChanges="orientation" />
along with the following code in the class file
#Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
This answer helps me to move to next operation without crashing my app but the problem is when i change from landscape to portrait, the background image and text also gets changed to portrait and half the screen the seems to be a blank one and text or not appearing fully.
this is the same when changed from landscape to orientation. i want the image and text to be fitted to proper orientation.
this problem has not occured before entering those manifest and coding lines
pls give me a solution.
You could try an explicit definition of your layouts.
For example have two layout files, one for landscape and another for portrait. Android is intelligent enough to use the best available layout -> Read HERE
To handle screen orientation gracefully there is something more you need to do -> Read HERE

Categories

Resources