I'm using Auth0 to manage the security of an android app and I need to customize my login activity.
I use the default LockActivity of the Lock.Android library. How I can change the icon of the LockActivity?
You can customize the LockActivity by implementing a style that inherits from Lock.Theme and overrides the Auth0.Title.Icon style attribute with your own app logo.
Here is an code example:
<style name="AppTheme.Lock.Theme" parent="Lock.Theme">
<item name="Auth0.Title.Icon">#style/eXigo.Lock.Theme.Title.Icon</item>
</style>
<style name="AppTheme.Lock.Theme.Title.Icon" parent="Lock.Theme.Title.Icon">
<item name="android:src">#drawable/ic_login_main</item>
</style>
Then in your Android Manifest file you need to change style of the LockActivity with your customized style.
<activity
android:name="com.auth0.lock.LockActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.Lock.Theme" >
You can see the other fields you can customize here.
Related
After signing in with the googleSignIn() method in flutter, there is an undesired transition appearing on the screen (Example : https://i.stack.imgur.com/CWIhL.gif).
This is not a glitch for the Android emulator, it also happens on my physical device.
The only solution I found was to add the following line to the styles.xml to disable the Transition :
<item name="android:windowAnimationStyle">#null</item>
However, I do not want to disable the animations for the whole app. How can I only disable it for the Login Screen ? I do not know what side effects may occur disabling all windowAnimationStyle for the whole app ?
You might be able to create a style for an individual view or a theme for a particular activity or view hierarchy. An example of this is given in the following link: https://gist.github.com/cesarferreira/38bf26a68317ac15f1dc
<!-- Developer should create a style -->
<style name="noAnimTheme" parent="android:Theme">
<item name="android:windowAnimationStyle">#null</item>
</style>
<!-- Then in manifest set it as theme for activity or whole application. -->
<activity android:name=".ui.ArticlesActivity" android:theme="#style/noAnimTheme">
</activity>
More information on Styles and Themes are given here: https://developer.android.com/guide/topics/ui/look-and-feel/themes#Styles
I used Android Studio to create basic activity using New -> Activity -> Basic Activity. But the activity background colour is black. I know it is to reduce battery consumption. But is there a way to change it to white colour, without changing style.
I tried to change the background colour of the root layout, but then it won't show hint text of edit text field. Because it's colour is white.
Then I tried to change theme from Material to Material Lite, then it wouldn't show the change when I run the app in the device.
Here is the activity declaration in AndroidManifest.xml
<activity
android:name=".SearchBus"
android:label="#string/title_activity_search_bus"
android:parentActivityName=".MapsActivity"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="uk.co.stableweb.iroute.MapsActivity" />
</activity>
In your styles.xml set the android:windowBackground attribute for whatever theme you are using for application or activity. You can find the theme you are using in your AndroidManifest.xml.
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">#color/somecolor</item>
</style>
</resources>
Note: If you have views in your layout that aren't transparent, it will block you from seeing the color you set here.
Did you try :android:background="#ffffff" i? It works for me
I am making android app using Visual Studio with the Xamarin platform.
As i read the document the thing I found.
.
As we can see there is only three Theme we can create. So my Question is can we set NoActionBar theme to Application as we can set in Android Studio.
Any Help be Appreciated.
You can use Theme with no Action bar in your app. For ex, you can specify Application Attribute in Properties\AssemblyInfo.cs:
[assembly: Application(Icon = "#drawable/Icon" Theme = "#android:Theme.Holo.Light.NoActionBar")]
Or set it in AndroidManifaset.xml
<application android:theme="#android:style/Theme.Holo.Light.NoActionBar" />
If that does not work, create a style with no action bar, like it's mentioned in here: https://stackoverflow.com/a/14061826/85606
No actionbar with styles
<style name="NoActionBar" parent="#android:style/Theme.Holo.Light.NoActionBar">
</style>
I am testing my app but when I choose settings my preferences screen shows White instead of the default black theme. Just with my app because any other app shows the right black theme in preference screen.
<style name="PreferencesTheme">
<item name="android:background">#000000</item>
</style>
add the above code in value -> styles and
then add
<activity android:name=".Preferrence" android:theme="#android:style/Theme.Black"></activity>
in your manifest file it will solve your problem :)
I guess you using the Light Theme in your AndroidManifest.xml. For those PreferenceActivity set the Theme like this:
<activity
android:name="PreferenceActivity"
android:theme="#android:style/Theme.Holo" >
</activity>
Why is there a difference between theme defined in AndroidManifest.xml and theme taken from styles.xml?
1) AndroidManifest.xml:
<application ... android:theme="#android:style/Theme.Black">
2) AndroidManifest.xml
<application ... android:theme="#style/AppTheme">
styles.xml
<resources>
<style name="AppTheme" parent="#android:style/Theme.Black" />
</resources>
1st setting gives black theme and no action bar. 2nd has dark action bar and light menu.
EDIT : options 1) and 2) - notice Menu and ActionBar
EDIT 2:
Why doesn't the 2nd option actually use the AppTheme (Theme.Black) ? (tested on SGS3)
You probably have another styles.xml file, perhaps under a directory like "values-v11", that is defining the #style/AppTheme differently than #android:style/Theme.Black and taking precedence over the file you're viewing/modifying.
#android:style/Theme.Black implements the exact theme implemented by Android (or device manufacturer). However, #style/AppTheme allows you to perform custom modification in your theme which actually extends the original Theme.Black from android, and in order to perform custom modifications, you use style resources.
In simple words, its just like using Activity class or YourOwnActivity class which extends Activity with extra features inside.
Styles.xml enables you to create your own themes. In AndroidManifest, you set the theme you want for an app or activity. You may want to use a system theme or your own. You can also extend other themes as you're doing setting "parent" attribute. For further information, check this out:
http://developer.android.com/guide/topics/ui/themes.html
You should try to put:
<resources>
<style name="AppTheme" parent="#android:style/Theme.Black" />
</resources>
in a xml file called res/themes.xml