The question is that I added a custom View element to my project.

 <org.adw.library.widgets.discreteseekbar.DiscreteSeekBar android:id="@+id/dsbHeight" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="6" app:dsb_indicatorColor="@color/color_white" app:dsb_indicatorFormatter="%03d Cm" app:dsb_indicatorTextAppearance="@style/CustomFloaterTextAppearance" app:dsb_max="220" app:dsb_min="145" app:dsb_progressColor="@color/ntz_color_lilac" app:dsb_rippleColor="@color/ntz_color_yellow" app:dsb_scrubberHeight="10dp" app:dsb_thumbSize="25dp" app:dsb_trackColor="@color/ntz_color_blue" app:dsb_trackHeight="10dip" app:dsb_value="155" /> 

and in order that I could access functions that are read from the app as shown above, I added such a line to the header of the XML file

  xmlns:app="http://schemas.android.com/apk/res-auto" 

And as I understand it, there is a library with various functions, the path to which we have indicated, after which we can use its capabilities. The question is where you can see the file with all its possible functions? I understand that he is on this path //schemas.android.com/apk/res-auto , but I do not have the res-auto folder in the project ... In general, I got confused

  • Previously, it was necessary to use a construction like: xmlns:local="http://schemas.android.com/apk/com.my.package.name" , then we added everything and the autogenerator of the local namespace and everyone started writing xmlns:local="http://schemas.android.com/apk/res-auto" - LamerXaKer
  • one
    click the left button, holding ctrl, by DiscreteSeekBar - Android Android
  • @AndroidAndroid When I do this, then I have a java class - Aleksey Timoshchenko
  • @AlekseyTimoshchenko I just thought you needed it) - Android Android

1 answer 1

The string xmlns:app="http://schemas.android.com/apk/res-auto" means that the markup must use the attribute namespace with the app tag (can be an arbitrary name), which must be obtained on the basis of the markup classes.

Which attributes will be available is determined by the code of the custom class of the element and you can see them by looking at the class code, or the values ​​declared in the res/values/attrs.xml for this class.

eg:

 <declare-styleable name="SomeCustomView"> <attr name="some_custom_attribute" /> </declare-styleable> 

Here, for the custom class SomeCustomView own attribute some_custom_attribute , you can assign a value in the markup as follows (subject to the declared namespace above):

  app:some_custom_attribute ="someValue" 

There is no universal list of these custom attributes - their names, the number and availability is determined solely by the code of the specific custom class and the associated attribute names associated with it in the attrs.xml file.

In the IDE, these attributes should be available in code completion, that is, by typing app: and by calling auto completion, you should get all the attributes available in this namespace for substitution. They should also be in the list of attributes panel in the visual editor.

  • By the way, what keys cause auto-completion? - Aleksey Timoshchenko
  • in Android Studio, it seems to work automatically as you type, and CTRL + Space (space) hotkeys. In Eclipse not in the know. - pavlofff
  • By the way, I don’t always have automatic completion in such cases, which is automatic, which works with Ctrl+Space , which sometimes confuses ( - YuriySPb