I change
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
to
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"
But why it can not change orientation?
If use android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen", it can change orientation.
But if change to another one, it can't.
I try it in Android 2.3.4.
But in Android 4.0.2, it works success on change orientation.
Why and how to avoid it?
Add
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"
to each activity you need.
Related
Portrait mode is working and landscape is not showing.
android:screenOrientation="portrait" // Here i need to show both portrait and landscape.
You can use:
android:screenOrientation="unspecified"
This is the default value and the system chooses the orientation.
alternatively, you can use:
android:screenOrientation="fullSensor"
In this case, device orientation sensor determinates the screen orientation.
Try one and the other to see which one works best for you.
EDIT:
For a specific class, you can do this:
<activity
android:name=".YOUR_CLASS"
android:screenOrientation="unspecified" // or what you want
android:theme="#style/Theme.Design.NoActionBar"/>
When my android phone is landscape,the screen size change,how to stop it?I kown that had edit manifest "configChanges",activity not start itself life again,but the display size had chang.
Just add in AndroidManifest.xml in activity tag:
<activity
android:name="MyActivity"
android:screenOrientation="portrait"/>
Add android:screenOrientation="portrait" to the element/s in the manifest . This will solve your problem. Or if you want your activity in always landscape mode you can add android:screenOrientation="landscape"
I've gone through quite a bit and I'm still at a loss for what I need to do:
http://developer.android.com/design/style/themes.html
http://developer.android.com/guide/topics/ui/themes.html
I have the view set to use the "Dialog" theme in my IDE (IntelliJ IDEA 14.1.2) and the application looks like this in the insepctor:
However looks completely different on my phone (Much larger resolution, but that's not the point).
What am I doing wrong and how can I get this effect?
i use this in one of my activities and it is ok:
<activity
android:name="eddine.charef.mechalikh.swipedemo.mapDialog"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog" ><!--add this-->
</activity>
maybe your android version doesn't support that.
Add to the Android Manifest
<activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
I am changing visibility of button at run time.
but when ever I am changing orientation I am getting default layout defined in XML file
So what should I do to keep the changes done in layout at runtime
Thanks...
not sure if it could work. adding the following into your AndroidManifest.xml which can prevent the activity from being restart when you change orientation.
activity ..........
android:configChanges="orientation|screenSize"
Inside file:
AdroidManifest.xml
<activity .. android:configChanges="orientation|screenSize" />
It works for me very well. That's what I was looking for.
Now, my Changes stay alive after I changed the screen-layout-orientation.
Thank you Ksharp, very much.
I've created a new style to set the background as transparent, but for some reason ever since the app doesn't change layout to landscape when device is rotated.
Should I specify something in the new style ?
Here is it's code :
< style name="Transparent" parent="android:#Theme.Translucent">
< item name="android:windowBackground">#color/background</item>
</style>
While you are not specify android:screenOrientation for activty, android uses
"unspecified" default value, which means that the system chooses the orientation.
In a case you are using style with <item name="android:windowIsTranslucent">true</item>, system selects an orientation based on the orientation of underlying activity in stack. So it's hard to get your application in landscape mode, because most of launchers fixed to portrait.
Just set android:screenOrientation="sensor" for all Translucent activities to force it choose orientation independently:
<activity
android:name=".SomeActivity"
android:screenOrientation="sensor"
...>
...
</activity>
I actually kinda solved it apparently the orientation is according to the background app in case of transparent background, since i kept testing when the Launcher in the back, i always got portrait only.
just right in manifest
<activity
android:name=".Ippin_NewActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name" >
</activity>