hello i'm a new android developer and I create an android app.
when the language of phone is English everything is good but when i change it to a right to left language (for example Persian or Arabic) location of views are changed. what should i do? thanks .
in your AndroidManifest.xml, add the following line to the application node's attributes:
android:supportsRtl="false"
Your final code should look like this
<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="false"
android:theme="#style/AppTheme">
...
</application>
</manifest>
Related
I have made some icon for my app and I have tested it on some old Samsung galaxy phone and it showed the icon is a nice square shape.
For some reason, on a newer phone + on the Emulator it shows a white circle as follows:
My manifest file looks as follows:
<application
android:allowBackup="false"
android:icon="#mipmap/ic_launcher_custom"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_custom_foreground"
android:supportsRtl="false"
android:theme="#style/CustomActivityTheme">
and my mimap is:
How can I solve it please?
Thank you
Move the mipmap content out of the project
then create app icons with Asset studio (right click on project panel > new > Image Asset)
and set icons in manifest like this:
<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">
I got the following code to customize my app icon and label:
<application
tools:replace="android:icon"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#drawable/appicon"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
Everything is all right, the correct icon and label show up in some phones (including brands like Samsung and Xiaomi), but when I install on a Huawei Mate 20 the result is the following image icon and label:
Do you know what I'm doing wrong? Thank you.
Most of the mobiles use round edged icon for the app icon. But other use with round app icons.Depends on the theme of the device(having a separate icon or same icon for both instances work). you should change the round app icon also :
android:roundIcon="#mipmap/ic_launcher_round"
to
android:roundIcon="#drawable/appicon"
and remove
tools:replace="android:icon"
it should look like
<application
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#drawable/appicon"
android:roundIcon="#drawable/appicon"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
please help me to do this, I need to implement ARABIC rating(Reverse) bar into my application.When I change my application locale into Arabic the rating bar should be reversed. I stuck with this for long.
You mean RatingBar with RTL
In Android 4.2, RTL is supported, AFAIK. In your question. We can use this attributeandroid:mirrorForRtl to RatingBar
Here's an example
<RatingBar
android:mirrorForRtl="true"
android:numStars="5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
You must also put android:supportsRtl="true" in <application > which is in Manifest file OR this will have no effect. By default, android:supportsRtl is set to false.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rtl" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="true" >
I have two different themes,original and demo. With a click it should switch from original to demo,but with different headlines.
In the Manifest file is the string for the headline declared, but how can I change it from there?
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme.MyAppTheme" >
I just want to change the android:label.
**may be you can try setTheme(YOUR_THEME); before calling setContentView(YOUR_XML); in activities..'
and you can define theme in your style xml
I've got an edit text on top of a list view and when I launch this default activity in android 1.6 the soft keyboard always show up by default. If i make focusable false it won't show but then I can't click it. Would a combination of focusable = false, focusableontouch = true resolve this or has anyone else run into this issue?
Note- on Android 2.x this is a non issue when I launch the app
In your AndroidManifest.xml, set this property inside activity tag: android:windowSoftInputMode="stateHidden".
For example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..."
android:versionCode="..."
android:versionName="..." >
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="..."/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:allowClearUserData="true">
<activity
android:label="#string/app_name"
android:name="..."
android:windowSoftInputMode="stateHidden" >
...