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.
Related
I'm brand new both to Xamarin and the Rider IDE, but not to Android. I'm going through some test projects, but when I make a new project, the ProjectName/Resources folder is missing things that I would expect to be there, most notably drawable. How can I create or get access to those directories so that I can do something like set the app icon?
I've tried creating a drawable directory, including it, and making sure that the build action is set to AndroidResource, but when I add Icon = #drawable/icon.png in the MainActivity, it doesn't recognize the drawable tag.
I found a solution for this. As I mentioned, I created the drawable folder manually, added the icon to it and made sure to right click and Include it. Then, in the manifest, I added android:icon="#drawable/icon and that got the icon to show up properly. So it didn't fix the issue of the folders not being generated, but at least for a simple task like updating the icon, it worked.
You can also declare in xaml.cs file, in your xaml form constructor the following:
x:Name_of_your_image/icon.ImageSource = (FileImageSource) ImageSource.FromFile("image/icon_name");
This way you won't need the drawable folders, as it will automatically provide the source of the image.
So I'm trying to configure in Settings--> Code Style --> XML how I would like the order of the attributes to be sorted when reformatting the code using ctrl+shift+L on Windows.
In my case, first all xmlns and other namespace attributes and then all the specific views attributes.
In order to do so, I tried playing with the rules preconfigured in the code style settings, and also by creating new rules.
By default, first xmlns tags are shown, then view attributes, and then tools:..., as shown in the image here:
When going to Settings--> Code Style --> XML, I tried playing with the preconfigured rules and even tried creating a new rule, but didn't manage to get the tools:... attributes to be displayed after the xmlns attributes.
This is an image of the code style settings screen, also with the rule, I tried to create.
Just to make sure, this is what I'm trying to achieve:
I also trying going over and over the documentaion but couldn't quite figure out how to properly create the rule, since it's not working.
XML code style documentaion
Has anyone tried changing these settings, and/or can help me with the setting?
Thank you
Found the answer:
1. Add a new rule
2. In my case:
Name = tools:.*
Namespace = .*
3. Done!
As you know every time you create new project with some activity, Android Studio generates a default activity_main.xml file with RelativeLayout as the root element and one TextView. But I prefer to use LinearLayout without any nested views. How can I change the way Android Studio generates the default activity_main.xml?
You can do that by editing default template files, which are located in:
...\Android\Android Studio\plugins\android\lib\templates\activities
so for example, default layout file for template of EmptyActivity (note: this one is specific, the other ones have their own res folders) is located in:
...\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout\simple.xml.ftl
by simply replacing RelativeLayout with LinearLayout in your favourite text editor, you get what you want, but instead of that, I recommend you to make your own template, where you can define literally anything, according to your desires.
Edit: For the BlankActivity and a guide how to edit the other templates see this link:
How to change a BlankActivity template default files and a guide how to do it for any others.
in our course, we hacked the default activity. It worked as expected, still a side effect occured while upgrading from Android Studio 3 to 3.1.
The installation wizard detected the default activity template was modified and we had to replace our hacked version with a stock one.
So I suggest creating your own templates in the way Android Studio expects it (ie, through the template options) for a smooth upgrade process.
I am working on a new Android application with a navigation with the fixed tabs and scroll-able default option Eclipse gives you.
But when looking on my .xml files for the mainActivity and the dummy file that are generated automatically, I can't find out where to edit the titles and whatnot for each individual tab section.
Do you know what I need to do?
You can change the default value of tabs by changing res/values/string.xml>title_section(x). Note: using resource string files should be something you get very familiar with as you should try your best to separate any "magic strings" from your code. Basically all strings should go in a resource file and be referenced through getString.
In the link given,there is code for 'circular-menu' view.
I am intrested in using that in apllication.
But not getting how to add that in application.
So,please help me.
Android Catch Notes App Like Circle Menu
That should be easy:
Search the referenced icons and put them in your res/drawable-???? folders
Possibly change the references to their ids
Copy the text into a new File named SmallCircleView.java in your src dir
Add the necessary import statements
Incorporate it in your layout
If that's not working, provide more information.