I have a default heading where there is the application name and a drop down menu of setting.
I am new to android so i was google on how to remove it, but i was unlucky to find a proper solution.
So how can i remove the top application name(AndroidAppOnTheWay) with drop down setting tab.
I tried removing some xml lines from mainactivity.xml file but whenever i build and run my program it crashes and gives an error.
You should use a Theme that doesn't contain ActionBar
For example:
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
Just make the title tag in your manifest.xml empty. This worked for me every time i need it. I don't know if this is best practise.
Related
This issue started happening when I copied a layout into another and tried to refactor the ID in the new file. It tends to refactor the ID in the source file also.
This is quite frustrating as the layout I've designed for a particular activity gets change everytime I try to update several IDs of its views.
I'm a super beginner in Android Studio and any kinda help/guidance would be really appreciated! Thanks!!
every time you refactor something, it will change everything related to that particular item or field, if you want to refactor an ID of an item it will change it in everywhere this ID is being used.
in order to change the name you can right click and choose refactor and rename or you can press SHIFT+F6 for a shortcut, it will ask you if you want t search it in comments and strings also check that box in order to really change it everywhere that this item is being used.
If you want to rename only the ID in the xml without it being changed in the java file, you'll have to change it by hand 1 by 1 b/c the refactor option will change it everywhere it is being used in your current project.
In Android Studio, I can't add any items from Palette to activity_main.xml in Design view. It just won't let me drag and drop them. Any idea why this happens?
Here is the PrintScreen:
According to new design method followed in android studio for android development you cannot add any elements to the activity_main.xml. Rather you should add them to content_main.xml.
You can learn more about it from this answer.
You can stop it from happening.
Answered by BNK:
If you create a new project, you can choose Empty Activity template
instead of Blank Activity. If you create a new activity, you can
choose Empty Activity instead of Blank Activity too.
how do I create an Empty Activity with a Fragment?
You start by creating an activity using the "Empty Activity" template.
Then, add a fragment class yourself or possibly via New > Fragment.
Please understand that all of the "New >" options, for activities,
fragments, etc., are all driven by templates. Those templates do what
they do. If you do not want what they are generating, don't use them,
and add the classes, resources, manifest entries, and such yourself.
Personally, I almost never use those templates, because it's simpler
IMHO just to create it all yourself than to rip out all the stuff you
don't need that gets generated.
I had same problem. In the design page, I saw error message "Render Error..."
I click Android Studio->check for update->update and restart
After android studio update, the drag&drop from Palette to design page works.
Check ConstraintLayout properties:
layout width and layout height should be "match parent", not "wrap content".
It works for me.
While you have marked a witget the editor don't let you drag.
I'm new to Android development and I just installed Android Studio version 1.2.1.1. I created a project, HelloWorld, and chose the default blank activity, Darcula theme, and default API. Straight out of the box, without having written any code or touched anything, I get this message:
"Rendering Problems
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'textViewStyle' in current theme (4 similar errors not shown)."
I uninstalled and reinstalled Android Studio but I still get this error so I'm not sure what else I should do. It says "use the theme combo box... or fix the theme style references" and I'm new to Android Studio so I have no idea where the box is or how to change the reference.
Simply click on the Refresh icon at the review pane:
Android gives you the option to define your own style format, which the default project you made did. It created a style named 'textViewStyle'.
If you look at the text view instead of the design view (you can switch by pressing the tab at the lower left in the part where you get the error that it can't render) you will see that the textView or the app itself contains a line android:theme="#style/textViewStyle".
You can either remove this line, or track down the error in the styles.xml file in the res/values folder. This is the file that defines the style for the app.
If this doesn't help you it could be that the style is defined in your AndroidManifest.xml file, look at the tag, it will contain a line saying android:theme="#android:style/textViewStyle", change that to android:theme="#android:style/Theme.DeviceDefault" and you should be good to go.
More info on custom themes: http://developer.android.com/guide/topics/ui/themes.html
Since you are a beginner, more on general Android development:
http://developer.android.com
Make sure to select the correct theme from the menu in the preview panel.
If you set the layout file to be FullScreen in the manifest but select something like NoActionBar theme in the preview panel, you will also get this error.
Go to manifest file, check the theme you are using there and pick the same in the Design view of your xml file.
Rebooting Android Studio did the trick for me. I couldn't find the "Refresh" button in the accepted answer for some reason.
Click on "Design" tab
On the right pannel, search for the objet "text" that contains something like "#string/hello_world"
Remove this value from the field
There's no more error.
I am now trying to implement viewpager with fragment. Everything is cool except i got error ViewPager has not been bound.
Exception details are logged in Window > Show View > Error Log in xml graphical layout.
And Here's a screenshot of my application.
Does anyone know why there is not showing indicator line below title ?
I did this project by referring this: https://github.com/JakeWharton/Android-ViewPagerIndicator.
Go through that sample project. It will really helps you to solve your problem.
For the records, hope it saves someone some time:
The Indicator needs to be bound to the ViewPager, something like indicator.setViewPager(viewpager)
Without a theme, the ViewPagerIndicator will not work. If you don't want to use the default style, set the ViewPagerIndicator style only as described here
Issue has been solved by myself. All i need is just to add theme style android:theme="#style/Theme.PageIndicatorDefaults" in project manifest file.
I am using this tutorial to try to replace the default TitleBar with a custom ActionBar. I am to the part where I am trying to create the xml layout for the custom title (#2 Under INCLUDING THE ACTIONBAR WIDGET IN YOUR APPLICATION), and the tutorial defines the ActionBar in the xml using
com.thira.examples.actionbar.widget.ActionBar
I have no idea how to figure out what to put there for my ActionBar. I believe this is called the package name. If so, how do I figure out what mine is. If not, what am I looking for here?
There are a couple options for figuring out your package name. The first (and easiest) is to declare it yourself in the project properties dialog:
Alternatively, if you haven't defined it yourself you can take a look at the AndroidManifest.xml file that is generated as part of the packaging step of the build. You can find it in the obj/Debug/android folder of your project.