This is my androidmanifest.xml activity code:
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen">
<intent-filter >
Use below code in all activity tag in MeniFest file
<activity android:label="#string/app_name"
android:hardwareAccelerated="true"
android:name="com.apnabanaras.ShowWebView"
android:windowSoftInputMode="adjustPan|adjustResize"
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen"/>
and remove this line
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
test this attribute:
<activity
android:label="#string/app_name"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:name="com.apnabanaras.ShowWebView"
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen">
Related
this is what i want
I am using the BottomsheetFragment what i want is the keyboard should be below the view . but in my case keyboard is overlaping the fragment view .
here is my xml file check my code here
and i am getting this output
I have created a sample app and tested on the bottomsheet xml provided
by you. By adding
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" in
manifest file did work.
So Manifest file looks as below.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Alternatively you can set this attribute dynamically as well inside onCreate in Activity class as follows
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
I have tried both ways on an sample app
After creating my main activity now I am adding splash screen but the splash intent is not opening the main activity.
After editing the manifest file
define .mainActivity outside .splash activity in manifest file
like below
cut
<activity android:name=".MainActivity"></activity>
and paste above
<activity android:name=".CustomList"></activity>
just change your manifest file like this
declare your MAinActivity outside the splash activity tag like this
<application>
<activity android:name=".splash" />
<activity android:name=".MainActivity" />
<activity android:name=".customlist" />
</application>
I need to disable splash screen auto rotate.
Need to show splash screen in portrait mode only. But app must rotate with auto rotate. How to do it in android studio ?
Add in Manifest file-->
<application
.........
>
<activity
android:name=".SplashScreenActivity"
......
android:screenOrientation="portrait"
/>
</application>
or for horizontal mode
<activity
...
...
android:screenOrientation="landscape">
In Your AndroidMainfest.xml put the screen orientation to your splash
<activity
android:name=".SplashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In the manifest, set this for your splash screen activity:
<activity android:name=".YourActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"/>
In manifest you can set the specific activity to be in portrait mode using
android:screenOrientation="portrait"
Just add below line in your manifest file, in splash activity tag
android:screenOrientation="portrait"
Something like below
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait" >
Add to your splash activity declaration in the manifest this lines:
<activity
android:name="SplashActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize">
Find relevant discussion here.
You Can do it by couple of ways
One
Inside the onCreate method of your activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Two
In manifest file
<activity
android:name=".NameOfYourSplashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope it helps
Add following code to your splash screen activity declaration in Manifest
<activity android:name=".YourActivityName"
android:label="#string/app_name"
android:configChanges = "orientation"
android:screenOrientation = "portrait">
or else add
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
to YourActivity.onCreate()
you can find a sample demo file here in github
try this in manifiest
<activity
android:name=".SplashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"/>
Here is my code to set orientation of screen
<activity
android:name="com.srikanth.lullaby.MainActivity"
android:label="#string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="com.srikanth.lullaby.SoundRecordingActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="com.srikanth.lullaby.RecorderActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="com.srikanth.lullaby.MediaplayerExample"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="com.srikanth.lullaby.MediaPlayerActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
but it is not working properly ,when i rotate the screen then app changing its direction
How to fix this.
Try this..
Just remove
android:configChanges="orientation"
Or in your java add this line after setContentView(R.layout.yourlayout);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Try to add like this for every activity tag:
<activity
android:name="com.srikanth.lullaby.RecorderActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
Try this
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
use theme in Application tag
android:theme="#android:style/Theme.Black.NoTitleBar"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation|screenSize"
The android:configChanges line prevents onResume(), onPause() from being called when the screen is rotated. Without this line, the rotation will stay as you requested but the calls will still be made.
keyboardHidden and orientation are required for < Android 3.2 (API level 13), and all three options are required 3.2 or above, not just orientation.
I had an app with several activities running perfectly until I added a new activity, which became the launch activity.
Now, the app stars in that activity but when I go to another activity it says Activity Not Found Exception even the activities are declared.
Here is my manifest, as I do not know what I am missing.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.visualizacion.Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".com.example.cuestionario.Page1"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape"></activity>
<activity android:name=".com.example.cuestionario.Page3"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape"></activity>
<activity android:name="com.example.cuestionario.Page2"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.cuestionario.Page4"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.cuestionario.Page5"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.cuestionario.Page6"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.cuestionario.Page7"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.visualizacion.Page1C"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
<activity android:name="com.example.visualiacion.Page2C"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape" ></activity>
</application>
When I go from Menu (Launcher Activity) to another activity it crashes with that exception.
Thank you
Check package path of your classes declared in Android Manifest and remove .(dot) from full class name. for Page1 and Page 3. i.e
android:name=".com.example.cuestionario.Page1"
and
android:name=".com.example.cuestionario.Page3"