Android:Changing layout theme where saved? - android-layout

I have two issues:
1 When i use to develop android application on eclipse i remarked that in layout editor there is the ability to change the theme,but i can't to figure out where these modifications are saved.
2 In AndroidManifest.xml whene i apply a light theme for an activity still it's black
Style file contains:
<style name="NoActionBar" parent="android:Theme.Holo.Light.NoActionBar"></style>
Manifest file contains:
<activity
android:name="com.example.myapp.MainActivity"
android:theme="#style/NoActionBar"/>
I am having trouble to figure out these issues.
Thank you in advance

Related

Unable to use only Light or Dark theme on Nativescript

I'm developing a Nativescript (version 6.3.3) app with Angular 8.2 and #nativescript/theme 2.2.1 with scss themes.
I'm trying to use only Dark (or only Light) theme regardless of system mode (Dark/Light) but nothing seems to work.
I followed this guide https://github.com/NativeScript/theme and I used custom color variables setting the dark ones equal to the light ones but it doesnt' work.
Can someone support me?
If you want to force Light or Dark mode only on iOS you can add the following to your Info.plist file.
For light mode:
<key>UIUserInterfaceStyle</key>
<string>Light</string>
For dark mode:
<key>UIUserInterfaceStyle</key>
<string>Dark</string>
Hope this helps!
Also {N} Theme 2.3.x have some important fixes to force the mode. Try with 2.3.2.
For Android,
First add this code in main.ts or main.js
import Theme from "#nativescript/theme";
Theme.setMode(Theme.Light);
Then change this value in styles.xml file located in folder values-v29 from true to false
<item name="android:forceDarkAllowed">false</item>

Android Studio 3.5.3 show Design view empty but build is Successful

newbie in Android studio. Using Android Studio 3.5.3 to create app and the Build is Successful
I have the default MainActivity and activity_main.xml
Problem:
when I clicked on the activity_main.xml
- The Design view empty. Thus I can not drag UI like Plain text or others onto the Design activity Layout
Made changes in Style.xml
added the Base in below:
1) style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"
but this does not work.
Need your help to solve this problem.
Thanks
#MikeBottle, There might be a couple of things going on here. It could be because your activity doesn't have theme assigned.
Please check this:
Note: In the design view, when you click the eye icon, it will give you the options to show / hide the layout decorations. It includes the top and bottom status bars. Please check if that changes anything.
Also, make sure the activity has theme assigned.
For the reference, I also included the layout preview to demonstrate how it look when show layout decorations is not checked.

I can't find the toolbar in the layout editor in Android Studio

I'm trying to do the Android Developer Tutorial.
They refer to the toolbar in the layout editor, in the tutorial picture it looks like this:
But this is what I see
.
The toolbar with the eye is missing. As you see, there is a "Toolbar"-Icon in the menu, but clicking it has no effect.
I'm using Android Studio 2.3 and followed the previous lessons of the tutorial as demanded. How can I activate this toolbar?
This is the link for building an Android UI.
Was having this exact issue. Spent an hour looking for a solution for this, and turns out it was really easy. Note that you will need android studio version > 2.2.
In the activity_main.xml, look for the component tree. Likely there is a Linear_Layout or Relative_Layout. Just right click and then click 'Convert to
Constraint Layout'. Done.
This is the result: image.
Hope this helps. Happy coding.
The tutorial was written before the split between activity_main.xml and content_main.xml. This split was made in Android Studio 1.4. activity_main.xml is the main file, which includes content_main.xml in the line:
<include layout="#layout/content_main" />
If you follow the tutorial exactly, it's having you open activity_main.xml, which doesn't have any of the real "stuff" in it. Since activity_main doesn't have the TextView that the tutorial is trying to get you to look at, you don't get the correct toolbar icons populating to do the next few steps.
Short story: In the section "Open the Layout Editor", under Step 1, you should open content_main.xml instead of the activity_main.xml that's indicated. Things should be smooth from there.
For more information about the difference between activity_main.xml and content_main.xml, see What is the role of content_main.xml in android studio 1.4?
You have to add the v7 appcompat support library in gradle. so you can add
android.support.v7.widget.Toolbar in xml layout.

In my Android App Actionbar is visible in View of Android Studio but on installing the app on Phone it is not visible why?

Also when i remove theme from manifest file Actionbar is visible on phone with some random theme.
I tried using other themes too but those are not working in giving me Actionbar.
I removed style file and tried to give theme in manifest file too but this didn't worked too.
My parent Theme is DeviceDefault.Light.DarkActionBar and Android Studio version is 1.1.0.
Thank you in Advance
ActionBarActivity javadoc:
Beginning with Android 3.0 (API level 11), the action bar appears at the top of an activity's window when the activity uses the system's Holo theme (or one of its descendant themes), which is the default. You may otherwise add the action bar by calling requestFeature(FEATURE_ACTION_BAR) or by declaring it in a custom theme with the windowActionBar property.
anyway, you have to use Holo theme if you are using API 11 or uper.
however, you can use AppCompat library. and set your theme ase: #style/Theme.AppCompat (or one of its descendant themes)

Android studio showing toolbar even though theme is set to theme.appcompat.light.noactionbar

In my project I selected Theme.AppCompat.Light.NoActionBar as the base theme, but in the Android Studio layout editor preview, it is showing a white toolbar with the activity name like this screenshot
This the style declared in styles.xml
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
</style>
But in the emulator it is not showing the toolbar. Anyone know why it is showing like this or a way to fix this.
Don't know, it can be considered as answer. But this is how i fixed it. It happened after i updated sdk to v22. Change the version of device shown in preview from 22 to 21.

Resources