Im make a basic activity but the label doesn't appears
I write in AndroidManifest.xml
<activity
android:name=".MainActivity"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/Theme.Peminjaman.NoActionBar">
and this is my strings.xml
<resources>
<string name="app_name">Peminjaman</string>
<string name="action_settings">Settings</string>
Anyone can tell me about this,if can make it,please tell me how to do?Thanks!
Related
Suppose that the Situm API key is already implemented.
I replaced the API key with ## in the code to not show the key for security.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.bkcnavigator" >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"`enter code here`
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.BKCNavigator"
tools:targetApi="31" >
<activity
android:name=".MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Google play services version -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!-- GMaps api key -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="##" />
<!-- Situm SDK credentials -->
<meta-data
android:name="es.situm.sdk.API_USER"
android:value="dr-montaa#hotmail.com"/>
<meta-data
android:name="es.situm.sdk.API_KEY"
android:value="##"/>
</application>
</manifest>
The Output:
It shows a Google map and a search bar (Not working yet)at the top.
I want the output to be like this:
It shows a google map with the image of the floor of the building.
I have already checked similar problems like mine but none of it helped. I also checked my previous project with the same AppTheme, they are the same but I have noticed everytime I create a new android project, the App bar is not showing even after several "Rebuild Project".
This is what my styles.xml shows
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
</resources>
This is what my AndroidManifest.xml shows
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mycontact">
<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">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
My MainActivity.java (Haven't put code yet)
package com.example.mycontact;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
And my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
</LinearLayout>
I have also tried changing the layout from ContraintLayout, RelativeLayout but nothing has changed. Zooming in and zooming out the layout doesn't change at all. Here is a snapchat.. Thank you for your help.
activity_main.xml page
Your styles.xml and other files seem to be in order, so try the following out.
Click the "Eye" icon on the toolbar above the XML Layout Preview, and then select "Show Layout Decorations" if it is unchecked. This should make it display both the AppBar and the system navigation bar.
Screenshots for reference, taken on Android Studio 3.3:
1. Layout with decorations missing
2. Press the 'Eye' icon, and select the option
3. The decorations (AppBar and system navigation bar) should now be visible
I'm trying to change the theme of some activities by removing the action bar or changing the title of it. At first i was doing it using the AppTheme option in the design tab. However, after searching online i knew that i was doing it the wrong way, so i proceeded to the AndroidManifest file to do my changes manually. Unfortunately, it's not working either. Here's the code of my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.wonderheart">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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">
<activity android:name=".MainActivity"
android:label="Sign Up"/>
<activity
android:name=".Login"
android:label="Log In"/>
<activity android:name=".drawable.welcome">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UserProfile"
android:theme="#style/AppTheme.NoActionBar"/>
<activity android:name=".HomePage" >
</activity>
</application>
</manifest>
Here are some of my activities that I'm trying to change:
Action Bar Title Changed Successfully
Action Bar Title Didn't Change
I'm using Android Studio 3.0 Preview and Kotlin. I hope you can help because i can't progress on my work without fixing this design issue!
You can fix problem two way.
1. Use common one theme for all activities and use code for hiding and showing action bar in onCreate method
// Set up the toolbar
val toolbar = findViewById(R.id.toolbar) as Toolbar
setSupportActionBar(toolbar)
var actionBar = supportActionBar
//For hiding android actionbar
actionBar.hide();
//For showing android actionbar
//actionBar.show();
Use custom style for activity where you don’t want to show action bar in example below I did it for application level but you can use it your way with your any other activities
style.xml
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "#android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
AndroidManifest.xml
<application
android:allowBackup = "true"
android:icon = "#drawable/ic_launcher"
android:label = "#string/app_name"
android:theme = "#style/NoActionBar" <!--This is the important line-->
>
<activity
In Android Studio project I have a separate class where I experiment with java code. The class has method public static void main(String[] args){}
Right click on this class in project tree -> Run (Ctrl+Shift+F10)
And I noticed that gradle starts building the whole project. And it takes certain time but I want it to build and run only this one class. So it is as fast as possible.
How can I achieve this?
You can try modifying your AndroidManifest file to run only the class you want as a main-launcher class:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/my_icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon,android:theme">
<activity
android:name=".RUN_YOUR_ACTIVITY"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For my application I want to make a custom theme with just a different color for my actionbar. So I found a theme generator on the Internet:'Android Action Bar Style Generator'. I picked some color and downloaded the theme, put my downloaded stuff in the res-folder and changed the 'style' to my new theme. For some reason my theme never applies to my application. It always uses the baseTheme which is also specified in the downloaded theme. This is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jobslot.indupac" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/bpi_logo_transparant_background"
android:label="Indupac"
android:theme="#style/AppTheme">
<activity
android:name=".LoginActivity"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity">
</activity>
<activity
android:name=".GraphActivity">
</activity>
</application>
</manifest>
This is my style:
<resources>
<color name="basic_text">#000000</color>
<color name="basic_text_buttons">#FFFFFF</color>
<color name="blue_bpi">#003676</color>
<color name="light_green_bpi">#D6FFDA</color>
<style
name="AppTheme" parent="#style/Theme.Indupac">
</style>
</resources>
I found a solution for my problem. When I applied the default theme "#style.AppCompat.Light.DarkActionBar" and added "colorPrimary" as an item, then it worked like a charm. Keep in mind not to put "android:" in front of "colorPrimary", because that requires API 21. Here is what i got:
<resources>
<color name="basic_text">#000000</color>
<color name="basic_text_buttons">#FFFFFF</color>
<color name="blue_bpi">#003676</color>
<color name="light_green_bpi">#D6FFDA</color>
<style
name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/blue_bpi</item>
<item name="colorAccent">#color/blue_bpi</item>
</style>
</resources>