Cannot enter unicode text in Android - android

I need to enter the text in unicode directly from the keyboard (Vietnamese for this time) but nothing happens. It once works with another simple app but I don't know what am I missing so this app won't allow unicode input.
I've tried
Properties the project -> Resource -> Text file encoding -> Other -> UTF-8
or <?xml version="1.0" encoding="utf-8"?> in every xml activity or even in AndroidManifest.xml but no luck.
Is there anything I missed? Most of the tutorials I found are listed above.
Thank you for your time.

Project properties only configures new files.
Edit the properties for each file and change the encoding to "UTF-8".

Related

Prevent android studio to create more than a tag in xml files

In the new android studio 3.3 or 3.2 if we create a for example button auto generate create a text like
<Button android:layout_width="" android:layout_height=""/>
but I would like something more like this
<Button
android:layout_width=""
android:layout_height=""/>
like old versions of Android studio is there a setting or something for that?
That is related to XML code wrapping. By default it should be on wrap always but maybe it's not in your Android Studio or they changed that in newer versions. Anyway you can find that by click on:
Preferences -> Code Style (expand it) -> XML -> Android(Tab) ->
Here you can find Layout Files and below options like: Wrap always, Don't wrap, Wrap if long etc. So set it on Wrap always and Apply changes and your XML code from now on should be wrapped.
It hints something that says reduce intent with 4 spaces. Try to configure that :)
Or use the hard way by pressing enter for the new row.

How to import font in Android studio

I am trying to change the font style in my Android App. So I copy and paste the font file (.ttf) into the assets folder. After pasting it show's File was loaded in the wrong encoding :UTF-8. How can I solve it? (attached picture below)
Note :
I already tried following ways.
a) convert file encoding to UTF-8
b) set the right file encoding in your build.gradle script.
But the problem is not solved yet. It still shows encode formats error.
I faced similar issue when I was playing with fonts. I think you are facing the same issue. In my Android Studio .tff file was linked to a text file. I changed that in the File Type option in Settings and font was working fine.
Steps:
Go to Settings
Select File Type
Search for .tff file
Deactivate linking as text (it maybe some other type in your case)
Hope this solves your issue.
Thankyou #Sreeram TP. This post may help to resolve that problem completely. I show my solution below.
After deactivating linking as text (pic1 below)
I deleted and re-pasted my font.ttf file. It then shows the following alert (pic2 below):
I selected Open matching file in associated application.
This solved my problem completely.
It is not a problem actually. You can still use the custom font like this :
TextView text = (TextView) findViewById(R.id.custom_text);
Typeface font = Typeface.createFromAsset(getAssets(), "yourfont.ttf");
text.setTypeface(font);

Xml files in Android Studio - Remove spaces inside tags in layout files

On Android Studio is there a way to remove unnecessary spaces between the attributes and 'end tags' (">" and "/>") when formating xml files?
I can't see this configuration "Code Style" options.
Based on the accept answer below I got a configuration that work for me:
In Android Studio's Preferences, go to Editor > Code Style > XML. Then select the Android tab on the far right. There are options in this tab to customize the formatting of Android XML files (manifest, layouts, etc.). Make sure Use custom formatting settings for Android XML files is checked. Then you can just format that file like you do any other file Code > Reformat Code.
To get rid of the space before closing tags, go to the Other tab. Under Spaces make sure In empty tag and After tag name are un-checked.

can't edit specific xml file in Eclipse

There are similar questions, but none address my specific issue.
I'm rather new to Android development and Eclipse but was able to follow the tutorials A OK.
In fact, I'm able to edit activity_main.xml from a tutorial, but now, in a test project I'm working on, I can't edit my new activity_main.xml (again, different project, same filename).
I created the file by right-clicking on the layout folder then selecting NEW > OTHER > Android XML Layout File. I was able to copy some of the other file so that my file now looks essentially like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
</LinearLayout>
When I type, the cursor moves around (looping through the text) but no characters appear on the screen. Again, in the other XML file I can edit with no problem.
I'm hoping that this is just some newbie problem.
I have had similar problems, though not this exact problem. Sometimes simply restarting Eclipse, or whatever editor you use, can help. Occasionally, Eclipse will not detect changes in your xml so you need to clean and rebuild the project. You can do this by
Winodow --> Project --> Clean...
and choose your project
I know there was an issue that I had which was similar with the editor jumping/replacing lines and such which I believe was fixed in a newer version of Eclipse. If I can find a source later I will edit
Clear all of text in layout activity_main.xml (in code view)
Drag and drop new LinearLayout in layout (in graphical view)
Go to Project -> Clean

is there one way to turn on code assist in animation xml

Eclipse give me a good experience in code assistence.But when it comes to animation xml files and i enter alt+/,it pop up nothing.So it make me very easy to type a wrong attribute name because of my poor english.can you give me a hand?
thanks.
Make sure that your animation xml file is location in anim folder not animation folder
I am not sure what you mean by "animation xml file" (the CEGUI ones? Android ones?), but, as explained in "eclipse editor, ex: xml editor, code assistance. how it works?", any xml file with auto-completion needs a DTD or Schema informtion.
Sometime, the DOCTYPE at the beginning of the xml file can prevent the auto-completion to work.

Categories

Resources