No resource identifier found for attribute 'indicator_gravity' in package - android

I was trying to porting the Tree-View-List-Android into my project recently. I have created a project called com.dotnetideas.treeview and added everything in. I can run the demo without any issue. But when I use it in another project, I kept getting “No resource identifier found for attribute 'indicator_gravity' in package com.dotnetideas.treeview” in main_demo.xml.
Here is the xml looks like.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:treeView="http://schemas.android.com/apk/res/com.dotnetideas.treeview"
android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView android:layout_width="0dip" android:layout_height="0dip" android:scrollbars="vertical"
android:visibility="gone"> <!-- Just to test some attributes in IDE -->
</ListView>
<pl.polidea.treeview.TreeViewList android:id="#+id/mainTreeView" android:layout_width="fill_parent"
android:layout_height="fill_parent" treeView:indicator_gravity="right|center_vertical"
android:scrollbars="vertical" android:smoothScrollbar="true"/>
Although I followed the old code to changed the xml namespace from
xmlns:treeView=http://schemas.android.com/apk/res/pl.polidea.treeview
to
xmlns:treeView=http://schemas.android.com/apk/res/com.dotnetideas.treeview.
It doesn’t seem like valid xml namespace.
It turned out that the namespace needs to be
xmlns:treeView="http://schemas.android.com/apk/res-auto"
if we reference as a library project.
This answer from stackoverflow too didnt help.

Related

No resource identifier found for attribute 'apikey' in package 'android'

<?xml version ="1.0" encoding ="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.Mapview
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:id="#+id/themap"
android:apikey = "AIzaSyDc9ac67bCYPqhVYz9pxhTJsK9shZH3iQg"/>
</LinearLayout>
it is my activity_main.xml file ...bt it shows the error mentioned above...i have also included android:name="com.google.android.maps" in my manifest file..plz help
Check whether in your project properties you have selected it as Google APIs
follow this if you still facing problem

Xamarin - error with layout file

I am trying to create a cross platform native app using Xamarin studio installed on windows.It currently targets Android.I am getting the following error.
Projects\sample\Android\Resources\layout\Main.axml(1,1): Error CS0116:
A namespace cannot directly contain members such as fields or methods
(CS0116) (sample.Android)
This is the generated layout file,I have not made any changes to it.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="#+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
</LinearLayout>

Android following class could not be found

I'am trying to load a spinner to my layout and keep geting this error:
The following classes could not be found:
- Spinner (Change to android.widget.Spinner, Fix Build Path, Edit XML)
heres my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Spinner
android:id="#+id/spn_dates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="displayDatesToSpiner" />
<ListView
android:id="#+id/LST_bought_products"
android:layout_width="match_parent"
android:layout_height="302dp" >
</ListView>
</LinearLayout>
Thanks
This sometimes happens when you rename the standard AppTheme in your android manifest. It will build and deploy just fine, but the xml design editor won't render it.
This is usually because there's an invalid attribute somewhere.
Remove the onClick and it will work.

IntelliJ: Getting GridLayout work

I try to use GridLayout in my App, but it wont work.
I used this Tutorial: IntelliJ and android.support.v7.widget.GridLayout
But it still wont work.
I get the following Error:
error: No resource identifier found for attribute 'columnCount' in package 'android'
error: No resource identifier found for attribute 'rowCount' in package 'android'
Any further tips?
EDIT:
work with my actual XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto"
android:layout_width="350dp"
android:layout_height="fill_parent"
android:orientation="vertical">
<EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:cursorVisible="false"
android:id="#+id/txtName"/>
<android.support.v7.widget.GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
grid:columnCount="3"
grid:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,1" />
 
</android.support.v7.widget.GridLayout>
</LinearLayout>
Today I struggled with this and on android dev site I found simpler solution and why they're problems with it. GridLayout from v7 libraries aren't connected with v7 appcompat library so you must add v7 gridlayout library dependency manually.
If you use gradle then in build.gradle just add
dependencies {
...
compile 'com.android.support:gridlayout-v7:23.2.0'
}
and everything should works fine :)
You need to use the full package and class name:
<android.support.v7.widget.GridLayout>
And add the namespace so that other controls will use the default package:
xmlns:grid="http://schemas.android.com/apk/res-auto"

osmdroid xml file

I've made an API that uses the osmdroid jar file and it is fixed on the center of London. The program works fine and you can navigate on the map but I still get this error in the main.xml file :
"org.osmdroid.views.MapView failed to instantiate"
Is there something I should do? Thank you.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<org.osmdroid.views.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/mapview">
</org.osmdroid.views.MapView>
</LinearLayout>
Maybe you've already found the answer yourself, but you don't have to be worry about it. I also have this in my project when I use a map view from osmdroid, even with google maps and it works fine. As you can see in my screenshot:
It's not needed to add " xmlns:android="http://schemas.android.com/apk/res/android" " in your org.osmdroid.views.Mapview tag. The only place where you have to add the xmlns is in your root layout item. In this case, as it it's done well, in your LinearLayout. See my code below of an example of my osmdroid tag and it's working fine:
<org.osmdroid.views.MapView
android:id="#+id/osmMV"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dip"
android:layout_weight="1"
android:clickable="true" />
Have a nice development!
Kr

Categories

Resources