I call the function to open the dialog. Dialog boxes have two EditText. When I open the dialog box, the keyboard automatically pops up. How can I disable this behavior? I only need to open the keyboard when the EditText receives a touch event.
on your onCreate() method
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
If you want all your activity use soft keyboard use this in your manifest file for your all activities
<activity
android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="stateHidden" />
Add this lines in your Androidmanifest.xml file android:windowSoftInputMode="stateHidden"
Example:-
<activity
android:name=".Registration_Screen"
android:windowSoftInputMode="stateHidden" >
</activity>
Related
I don't want to move layout up in fragment.
I have attach activity screenshot.
AndroidManifest.xml
Add android:windowSoftInputMode="adjustPan" in your Manifest activity tag
<activity
android:name="ACTIVITY NAME"
android:exported="false"
android:windowSoftInputMode="adjustPan" />
For my android application, when a user play a video, a new activity (VideoPlay) starts in pip mode.
Manifest (Video Play)
<activity
android:name=".PlayVideo"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar"
tools:ignore="LockedOrientationActivity"
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"/>
The problem is when i click on close button "X" of the pip screen, a new instance of my app is created.
how to handle this problem ? thank you
That is not another instance of your app, but rather a different task which houses your PlayVideo activity. To prevent showing your activity in recents screen, you can add android:excludeFromRecents="true" in the manifest attributes of your PlayVideo activity.
Also, if you're force closing your PlayVideo activity in some way other than user interaction like backpress, you may like to call finishAndRemoveTask() instead of just finish() as calling finish() will not remove your activity from recents.
So, I saw that thing in the Todoist app. When you click the add fab, the keyboard pops up with some layout above it where you can enter text and set some things. How can I do it?
This is how the thing actually looks:
Is there some example on how this is done?
(please don't mind that this is the iOS version of the app, I don't own a android device)
Make bottom sheet with fragment and edit text in fragment,and set button fab to show bottom sheet when clicked,,you can set the bottomsheet visibility GONE if you want
Add this android:windowSoftInputMode="stateHidden"
line in your Activity block in manifist.xml file like this
<activity
android:name=".Activities.DashboardActivity"
android:label="#string/title_activity_dashboard"
android:windowSoftInputMode="stateHidden"
android:theme="#style/AppTheme.NoActionBar">
</activity>
I use Android Studio 1.5 to create an Android application.
I added a blank activity using context menu but I forgot to define a hierarchical parent for that activity.
So I changed in AndroidManifest.xml this
<activity
android:name=".CategoriesActivity"
android:label="#string/title_activity_categories"
android:theme="#style/AppTheme.NoActionBar">
</activity>
to this
<activity
android:name=".CategoriesActivity"
android:label="#string/title_activity_categories"
android:parentActivityName=".CitiesActivity"
android:theme="#style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="info.emitikon.mycity.CitiesActivity" />
</activity>
Anyway I cannot see the BACK arrow button at the top menu.
What do I am missing here?
Add these lines in the onCreate method of your Activity:
ActionBar = getActionBar(); // or getSupportActionBar() if you are using the suport library
actionBar.setHomeAsUpIndicator(R.drawable.ic_launcher); // your custom icon
actionBar.setDisplayShowHomeAsUpEnabled(true);
I have this Layout.
every time it's opened, the android keyboard appears
why is that?
how can I avoid this?
Add this to your manifest file, You can avoid that.
<activity
android:name="Your_Activity"
android:windowSoftInputMode="stateAlwaysHidden" >
</activity>
If the EditText has requestFocus,then keyboard might display automatically. It has nothing to do with your xml code.
Add the following line to your Manifest File inside each Activity tab
android:windowSoftInputMode="stateAlwaysHidden"
or add the following to your parent layout in that activity
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
Strange ! I thought Screen which has editText only get focus.
Try this => Stop EditText from gaining focus at Activity startup
Android opens the OnScreenKeyboard automatically if you have an EditText focussed .
You can prevent that by adding following into your Activity's onCreate method.
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);