I have this issue in my App, which is super weird.
I have an app, when i press Run on Android Studio, it starts the app with the correct layout's direction. Now, i press Back button and go back to the app, it shows a RTL layout instead of the current, correct LTR layout.
The app is pretty simple, it has an Activity with a NavigationButton in the Toolbar, when its flipped, the NavigationButton goes from left to the right, with a false pointing direction.
The app is LTR, supports only English, and tested on an English device, the same result is happening on the Emulator. I have the final version of Android Studio.
Layout, with Toolbar, along with navigation attribute, to enable back arrow.
Activity which setContentView and just shows the layout.
Back pressing, or re-opening the App without clearing it from the BackStack, shows the visual bug.
What cause the issue? as the code is pretty simple and doesn't have anything hardcore.
Manifest Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.corF.app">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:supportsRtl="true"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity
android:name="com.corF.app.activities.ActivityStartup"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
A library which i use (SliderLayout), has a code which forces the app to show RTL. On the first launch the SliderLayout forces the RTL, but it doesn't take change until i re-open the app without fully removing it from the backstack.
Silly issue, but yeah, this's the solution.
Related
This is not a duplicate of Android Application creating two launcher icons (I don't have multiple LAUNCHER definitions in my manifest), nor Android Application Creating Two Launcher Icons instead of One (a restart of the device does not remove the second launcher icon).
My android application is creating two launcher icons, but one of them seems to be coming from the application itself, rather than any activity. I've cropped my AndroidManifest.xml to the smallest it can be (plus clean and rebuild and reinstall), and I am still getting two icons (on both my HTC One M8 physical phone and my Nexus 5 emulator):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
There is nothing else in my manifest.
...does the application itself as I've defined it create an icon somehow? Or is there some other way that I'm ending up with multiple launcher icons?
If I move the android:label and android:icon features into the .SplashActivity definition, one of the launcher icons created is replaced with the default little green robot icon.
Activities and other bits of manifest-y goodness come from a variety of sources:
the manifest in your main sourceset
the manifest in any build type or product flavor sourceset
the manifest in any library module or AAR
Gradle (e.g., minSdkVersion)
Android Studio 2.2 gave us a convenient tool to examine the real manifest that goes into our APKs, merged from all those sources. If you open the manifest in Android Studio, click over on the "Manifest Merger" sub-tab (towards the bottom of the IDE). That will show what is in the merged manifest and who is to blame for it where it came from.
If you see other activities in there besides the one in your manifest, that is the source of your launcher icon. Then, you'll need to decide:
is that activity something you really want?
if not, is the source of that activity something that you really want? (if not, nuke it)
if you want the source but not the activity, you can rig up another activity element in your manifest, with a tools:replace attribute, to override the one from the library and suppress the <intent-filter>
My problem was, that I've added the following intent-filter to multiple Activities. Configured it for one Activity fixed the issue for me.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
My app stops from working for some reason when the phone is rotated to the side and so the app does too. How can I avoid this, making it so it appears only vertically? Thanks a lot
add this to your activities in android manifest :)
android:screenOrientation = "portrait">
Here is a full example:
<activity
android:name=".Activity.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
</activity>
In your app's manifest file, set activity to be vertical... Its easy...
I'm attempting to react to a size change in my app. Or more specifically I'm trying to figure out when the keyboard shows up.
I've tried #Override ... onSizeChanged() of the main windows (a RelativeLayout view extension)
It gets called when I change the orientation, but not when I show/hide the keyboard.
My layout is not scrolling, so the controls at the top of my screen fall out of view, and the only way to get them back is to hide the keyboard.
I've read a pile of other sites and googled the snot out of this one, but it has me befuddled.
Oh.. I'm on a 2.1 (aka 7) build of android, and I'd like to be able to run the app on my own phone :)
Oh.. so the question. How do I catch something resembling onSize on an android device.
Try to add below to related activity in manifest.xml
android:windowSoftInputMode="adjustPan"
For Example
<activity android:name=".SignUp"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.ACTIVITY" />
</intent-filter>
</activity>
As by default, the application name is appearing on one label like TextView. How do i remove my titlebar permanently for my application?
Any ideas?
You can use below code for that -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar" />
If you want the full screen of your device you can use below code -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
And, also refer Developer's Site
That is a setting based on the activity in your android manifest file.
Use the No Title Bar theme for your activity.
<activity android:name="MyActivityName" android:theme="#android:style/Theme.NoTitleBar" />
i just followed the tutorial on tabs creation from the android dev documentation
and my tabs didn't turn out the way they probably should. Here is a screen on how it looks for me:
alt text http://bombhot.se/files/923947/messedtabs.png
and here is how it should look like:
(source: android.com)
I found som threads that talks about putting localisation on the tabhost and make every activity follow the same configuration but it hasn't worked for me so far. Wondering if
there's something i'm missing, here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.koollateral.myWallet"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon"
android:label="#string/app_name">
<activity android:name=".mywallet"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".homeActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".calendarActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
</application>
</manifest>
I've done this API example before, and I think all that has happened is you have swapped your images compared to the example. Note how the tab uses the negative space of the image as the contrasting colour, while you matched the negative space to the background colour. So if you go into your drawable folder and change the xml file you created for the tabs by swapping the images, it should look a little closer to the example.
Other than that, what do you think isn't right? It appears that you have done the exercise correctly.
Edit: also as a tip, you can put android:theme="#android:style/Theme.NoTitleBar"in the <application> instead of having to put it into every Activity. Then none of your activities will have the title bar.
There seem to be two problems. You have listed the images reversed. Meaning you have the selected and unselected images backwards. Also it looks like they are not the right size. You need to consider the dpi of the device you are targeting.
Hi guys since Android 2.1 the tabs are more square look, my solution was adding a selector containing images with rounded corners.
tabs.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.mytab_roundedcorner);