Android Language Translation Error - android

I am Developing an Android Application, by default it is running in English properly then i Translate it in to Welsh and Urdu by translate String file into corresponding language and placed it into values-cy and values-ur.When i run it show error message like
' 02-09 05:07:35.083: ERROR/AndroidRuntime(584): Caused by: java.lang.RuntimeException: Binary XML file line #11:'
You must supply a layout_width attribute..I studied that particular xml but it didn't noticed any problem in that line but it worked in engish properly(I used Styles/String and Theme in my resource).After that i create a new xml file with only one Textview here i gave all styles within that Tag..
.Now i locked with this problem.So please help me to solve this problem.

I think you are using custom theme. If so,call styles from theme. May be it will work.
Try it.. Happy coding :)

Related

Does Android Studio Linter Offer An Option to look for default XML layout values?

1.) Is there any reason to have a default value inside an android xml layout?
Ex.) The TextView below has included a default value of
android:visibility="visible"
`<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:visibility="visible"/>`
Conjecture: Because this is a default value, it has no effect, and therefore is an unnecessary line of code in the XML file. Is that line of thinking correct?
2.) If there is no reason for default values to exist in Android xml files, is there a lint plugin available to point out default value code lines in android XML files?
It is my thought that a large number of code lines in XML files are default values, serving no purpose. What can we do to reduce these lines of code?
U can create a style with your default values and use it.
For example:
<style name="DefaultTextViewStyle">
<item name="android:visibility">visible</item>
</style>
to use this:
<TextView
style="#style/DefaultTextViewStyle" />
I had some hope that the Lint inspection Redundant default value attribute assignment for xml, run via Android Studio might have done what you're asking. You can run it as specified under the Manually Run Inspections part of the Android docs. i.e.Android Studio -> Analyze -> Run Inspection by name -> enter "Redundant default value attribute assignment", then select the scope for the Lint check.
Sadly though, it doesn't pick up the case you mention above. I'm just wondering if there's something I've missed, or if this isn't intended for Android xml in some way?

Error using "Theme.AppCompat" with Android Studio 2.1.0

In my android project, I am getting the error "Cannot find symbol for Theme.AppCompat" while using it in styles.xml file:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
I have included the app compat dependency in my gradle file:
'compile 'com.android.support:appcompat-v7:23.3.0'
I tried finding the solution all over internet but nothing helps. Can someone help me with this..
Just wanted to let you know that you're not alone. Everything was working fine in the app I was developing, testing heavily on a marshmallow nexus 5 and a lollipop samsung tablet. I must have let something automatically update, because now I'm having problems with appcompat.
Here's an example of what's going wrong:
in a layout XML I have an edit text with style specified:
style="#style/Widget.AppCompat.EditText"
This will cause 'Error inflating class EditText'
if I create a style for the edit text in v21 styles with a parent of 'Widget.AppCompat.EditText' and specify the background (my color, or drawable, or ?android:attr/editTextStyle) it will work - though all of these options lose the edittext underline style.
If I specify background of ?attr/editTextStyle it will fail to inflate, which I assume is the default, it will fail to inflate. Likewise, if I leave any style tag off of the edit text, it will also fail to inflate.
Glad I'm not alone, but I wish this wasn't a thing...

Android Eclipse project using the Graphical Layout can't add TextView or MultiLineView

I've looked at several other questions related, one answer even seemed like it solved the problem however I was wrong.
The issue is I get:
Parser exception for C:\Documents and Settings\djordan\My Documents\SampleTest\AndroidManifest.xml: The markup in the document following the root element must be well-formed.
When I drag/drop a new TextView or Multiline Text view item to the canvas. All other Text Fields add fine.
EDIT: Pasted the wrong error ... updated. and Added following work flow:
1. open SDK, check API 16 installed.
2. open Eclipse, create new Android project
- name, target/minimum API 16
3. in Graphical Layout drag "Plain Text" or "MultiLine Text" from the Text Fields.
4. view error above.
Flip over to the xml page, go through and find the textView you just added. Find the attribute where it says android:textSize="18" and change it to android:textSize="18dip" That should solve it. The error is telling you that the units for that attribute are not valid or were not set.

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.

Error Parsing XML for android:drawable

Hi
I am facing a problem
I want my application to pick up resources from the framework. Here is my code snippet of an xml.
For this to be achieved following changes were made in attrs.xml
and themes.xml at the framework level
#android:drawable/btn_minus_ss
The drawable btn_minus_ss.png is added to drawable-hdpi folder at the location framework/base/core/res/res/drawable-hdpi
Whenever I open the application, it crashes.
I get the following error in logs
ERROR/AndroidRuntime(3701): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: tag requires a 'drawable' attribute or child tag defining a drawable
However, when I use this
android:background="?android:attr/theme_btn_minus_ss"
I don't get any error. I want to use
android:drawable
What is the cause and how can this problem be solved.
Thanks & Regards
Aviral
The error
ERROR/AndroidRuntime(3701): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: tag requires a 'drawable' attribute or child tag defining a drawable
has to do with the format of your xml, you are setting something like
<item android:background="#foo-value-here" />
What the error is telling you is that it should be like this
<item android:drawable="#foo-value-here" />
i think i had the same problem, it seems to be a bug in the android eclipse-plugin. the solution is the same as for this question (close eclipse and restart it): android include tag - invalid layout reference
Also make android:drawable the first attribute of item tag - it worked for me.

Categories

Resources