Xamarin.Android No style resource found - android

I'm using Xamarin for an android app on MacOS, my question is very simple but I haven't found anything online and I'm getting mad at this: I just want to set the app style to be Fullscreen and without a title bar so I changed my Manifest.xml as follows:
<uses-sdk android:minSdkVersion="23" />
<application android:allowBackup="true" android:icon="#mipmap/icon" android:label="#string/app_name" android:theme="#android:style/Theme.Material.NoTitleBar.FullScreen"></application>
And when it tries to compile it gives me the following error: No resource found that matches the given name (at 'theme' with value '#android:style/Theme.Material.NoTitleBar.FullScreen')(APT0000)
I tried every other fullscreen theme and no title bar that Xamarin suggests in the drop down menu in the designer but it gives me always that resource error

I just want to set the app style to be Fullscreen and without a title bar
You can add this in your AppTheme:
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
And your application doesn't need to change, just refer to it:
<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">
</application>
I can't find style/Theme.Material.NoTitleBar.FullScreen in the source code.

Related

How to show the title bar in the design review?

When I am designing a layout, the design review does not show the title bar, but the simulator can show the title bar, as you can see below:
My style.xml is showing as follows:
Also, my Manifest is writen as follows:
<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>
Is there any ways that I can keep the title bar all the time when I design my layout? even though I create many layout file, I still hope that every layout can keep the title bar.
You need to change theme in Editor
like below image it will work
Check the current Theme in the Android Studio Design Preview :
It must not end with ".NoActionBar", you can set your theme "AppTheme".
If you are using 28 API. please change API VERSION to 26 and use this
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

how to add logo with app label in android studio

<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:logo="#drawable/logo"
android:theme="#style/AppTheme" >
This is my androidmanifest.xml
and in mainactivity.java i use this lines to show logo in action bar.
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.logo);
after using this two lines in .java file my logo is showing in the display but the app label is gone....
is their any method by which logo & app label both will shown in actionbar after compiling apk.
You not need the two lines in mainactivity.java, you have to select a Theme with the ActionBar:
From res>layout>activity_main.xml(or whatever is the name of the layout of your activity): in the "Design" tab change the theme in "Holo.Light.DarkActionBar" for example.
Or from the AndroidManifest.xml in your app add (or change):
android:theme="#style/AppTheme"
where "AppTheme" is defined in res>values>styles.xml as:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
Of course in your manifest you have to define the name and logo in the <application> level:
<application
android:logo="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme"
...
Add this into your Activity in manifest.
<activity
android:name=".MainActivity"
android:label="#string/app_name"
</activity>
copy your image file and paste it to the res->minmap folder and then goto your AndroidManifest file and locate the below option
android:icon="#mipmap/image_file_name"
give your icon image file name name here (image_file_name) then run your app.

How to change headlines of a theme with a click?

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

Theme not being applied

I am simply trying to change the background color for an activity, however nothing has changed.
Here is the relevant XML:
styles.xml
<resources>
<style name="STBTheme" parent="android:Theme.Light" >
<item name="android:windowBackground">#color/blue</item>
</style>
</resources>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pedro.stb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/STBTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/STBTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Furthermore, I'm using Eclipse, and by changing the theme in the activity's xml, it does not change in the graphical layout.
Any help?
Edit
Got it to work. Have to clean the project before reloading the layout. Very annoying...
i had check your code its ok .
try <item name="android:Background">#ccff33</item>
instead of your <item name="android:windowBackground">#color/blue</item>.
and you have write android:theme="#style/STBTheme" > in application as well as activity also.
Just write in application tag .
Hope you will get your output now.
Open the preview of your activity and Click on the circled button as shown
Type the name of your custom theme and Click 'OK' as shown
In Manifest file add the attribute android:theme=".YourTheme" to the required Activity
You will have the theme of the current activity changed.
I dont know why Android Studio acts like it's drunk sometimes. I have two projects with same target,minimum SDK active. One of them had the splash screen theme implemented correctly, the other just wont show until I found this workaround.

how to Remove the space for showing Application name

I developed an application. I would like to remove space that is used
for showing application name on top of my application UI. (The Title Bar)
I set Application label as null In manifest File But it will not remove the space for showing Application name
Please tell me what is the correct or possible way to do that
Thanks in advance
You request window feature in your onCreate method:
#Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
}
or in AndroidManifest.xml:
<activity android:name=".YourClassName"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
i think you can add this line in you application tag in android manifest file
android:theme="#android:style/Theme.NoTitleBar"
For android studio:
In android AndroidManifest.xml file change the theme like: android:theme="#style/Theme.AppCompat.Light.NoActionBar"
example
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" >
you can use this style
<style name="MyTheme" parent="#android:style/Theme.NoTitleBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">#drawable/xyz</item>
</style>

Categories

Resources