We always know set android:icon in Manifest can set icon and logo,
android:icon="drawable resource"
Can I set logo icon in Main Activity with Java code?
thanks for help
This answer could help you.
Extract from mike yaworski's answer:
Summary:
android:icon="#drawable/ic_launcher" determines your launcher icon, so
just add images to the drawable folders and change ic_launcher to
whatever the name of image is that you want to be the icon.
android:label="#string/app_name" determines your "label" so just look
for app_name (because the label is referenced to #string/app_name) in
your strings.xml file and change the contents of app_name.
Related
I cannot update the icon on the homescreen. It is the green robot default android icon. How can I change this to the icon?
I have added icons in the app > src > res folder for different resolutions.
I am uploaing my app using the play console. Any ideas?
My manifest states:
android:icon="#mipmap/ic_launcher"
The name matches the image in the assets folders.
Here is a link to my repo:
https://bitbucket.org/matthisco/ejected-calendar/src/master/android/app/src/main/
Change project to android
than go to res>mipmap>paste your icon there (iconName.png)
replace
android:icon="#mipmap/ic_launcher" in manifest
to
android:icon="#mipmap/iconName"
You can update the homescreen icon as follows:
In AndroidManifest.xml under application tag
<application
android:icon="#mipmap/yourdesiredIcon"/> // replace ic_launcher to desired icon
Goto app > src > main > res
rename your icon to ic_launcher.png and paste it to all mipmap folders
The correct folder where the Android icon must be placed is res->mipmap-xxxx where xxxx signals the screen resolution.
Also check that your manifiest is using it. Open the manifest and in the application tag you should have something like this:
android:icon="#mipmap/ic_launcher"
Also verify you icon is named ic_launcher.
As you can see that entry in the manifest says "go look for the icon in the mipmap folder, use the one named ic_launcher"
I faced the same issue, but I realized that in the Android Manifest
android:roundIcon="#mipmap/ic_launcher"
android:icon="#mipmap/ic_launcher"
were pointing to the same images, which were square. The phone I was testing on had a round icon, and so the default android image was displaying, I presume because the format was incorrect.
When I then tested on a phone with a square image, the images were displaying correctly.
When reviewing my app, I noticed that the blue bar on the top and the text in the bar (the project name) does not fit in the app.
I tried changing the project name into a more relevant one by going into REFACTOR -> RENAME but it said 'can't rename root module.' every time I tried to.
Is there a way I can either delete the blue bar or change the text on it?
Are you familiar with the resources strings object? Let me know if this makes sense... Look at the image that I've included. Go to res/values/strings.xml and make the app_name tag be empty
<string name="app_name"></string>
Project name for Toolbar is defined in res/values/strings with key app_name by default.
In strings.xml, change app_name.
Or there's a setText method on the ActionBar class
To remove the bar depends on the theme used by that Activity (or if you explicitly show a Toolbar in the XML layout)
The name of your app is defined in your AndroidManifest.xml. Inside, you'll see an Application object, with a property of ApplicationName. Set this to whatever you want.
for remove top bar use in Manifest file :
<application ....
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
>
The title of the action bar (your blue bar on the top) is set inside you AndroidManifest.xml, inside the activity tag:
<activity
android:name=".activity.MainActivity"
android:exported="true"
android:label="#string/app_name" >
</activity>
A good practice is to refer to a string stored inside Strings.xml
<string name="app_name">My cool app</string>
getActionBar().setTitle("TITLE");
OR
getSupportActionBar().setTitle("TITLE");
I have downloaded a Android Navigation drawer sample project and trying to use that. At the initial state, i don't know how to change the navigation drawer title icon to different icon image. where exactly is this image located specifically? Is it under any specific Res->drawable folder? Please find the screenshot, where I rounded the navigation title icon image, which I want to change now.
You can change it in your AndroidManifest.xml, put your icon in your res/drawable folder and set the "logo" param to your icon like this:
<manifest>
...
<application
...
android:logo="#drawable/your_image_file_name">
</application>
...
</manifest>
You can find it being set in your manifest. It automatically accesses #drawable/ic_launcher as your app icon
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Byustudiestab" >
You should change your app icon in AndroidManifest.xml
android:icon="#drawable/ic_launcher"
where exactly is this image located specifically? Is it under any specific Res->drawable folder?
To find where the image is located in eclipse, do the following: res -> drawable
Also the image might be locate in either drawable-hdpi, drawable-ldpi, drawable-xhdpi, drawable-xxhdpi
Once you find the image location, replace the image with an image of your choice. Either give the image a new name or keep it the same name as the old image. If you decide to give the image a new name you will have to head on over to the AndroidManifest.xml and replace the old name given to the old image with the new name that you gave the new image.
android:logo="#drawable/your_image_file_name"
Another option:
getSupportActionBar().setLogo(R.drawable.yourImage);
or
getActionBar().setLogo(R.drawable.yourImage);
Note: Attribute "logo" is only used in API level 11 and higher android:logo requires api (if you don't use getSupportActionBar)
I am new to android programming.I have started building an app using eclipse.In the layout file the app icon and App name comes there by default. How do I change it.
A relative layout is there by default.
Whatever I add say--image view textview get added below the main title bar.
How do I change this?
Links to app name and icon are placed in the AndroidManifest.xml inside the application tag. String resources, like #string/app_name, are placed inside the strings.xml file in the res/values directory. Drawable resources, like #drawable/ic_launcher, are inside the res/drawable set of directories. Good luck!
try This
For Logo
android:icon="#drawable/icon"
For Application Name android:label="#string/app_name"
As already pointed out by Egor, you must change the appropriate string in your strings.xml. Typically, the key name in the strings.xml is by default app_name. Change this to whatever you wish to change your App's name to.
For your App's icon, I would recommend using this website to create the appropriate resources: http://android-ui-utils.googlecode.com/hg/asset-studio/dist/icons-launcher.html. This saves the trouble of creating different size resources. It gives you all of them in on go. Once you have downloaded the new set of icons, just replace the old set of icons with the new set. Take care of the name though. Again, typically, the app icon has the name ic_launcher.
Simply U have to change in Androidmanifest File in application tag which include property like For change logo use android:icon="#drawable/icon" property and change drawable image as per your requirement and for change application name use android:label="#string/app_name" property and write at string.xml file in app_name label put appropriate name for that.
I'm trying make Preference Screen like on below image, was used style for SettingActivity in manifest and layouts for PreferenceCategory title, but i not understand, how can do widgets on screen was white color. And i don't know how can i place title image on the top of screen (where is a text "setting").
Anybody can help me in this question?
xml you can remove the label tag
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
//from string.xml
<string name="app_name">Settings</string>
and add in your activity as
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.page_layout);
requestwindowfeature(Window.CUSTOMTITLEBAR, R.layout.titlelayout);
custom title link: