Where is the link to Android Android UI layout?

I am looking for a specification or a link to all the possible parameters for the various attributes of the XML layout attributes that usually come with the Android user interface. Google seems to be good to bury it. This is similar to this question, but remains ineffective.

How are my options available to me for defining layout_width TextView? A full definition should be published ... somehwere ....

+4
source share
3 answers

layout_* attributes are not directly part of the view on which they are displayed, so you will not find them in the TextView documentation. (TextView is not a ViewGroup.) They are arguments to the parent view, also known as LayoutParams . Take a look at the Known Subclasses sections at the top of the page listing them. These are instructions on how the ViewGroup should arrange each child view, and each parent type can recognize different depending on what layout options it supports.

For example, LinearLayout.LayoutParams supports the android:layout_weight . LinearLayout can specify a weight to request a fraction of the remaining space after all children have been measured. You can give equal weight to two TextViews with a base width of 0 to give them every half of the available space inside the parent.

 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="Hello" /> <TextView android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="World" /> </LinearLayout> 
+2
source

Developer.android.com is usually your site. Maybe this helps: http://developer.android.com/reference/android/view/View.html

If you use Eclipse, autocomplete suggestions will also help you in adding the right parameter.

... and the options you have for layout_width,

  • wrap_content (the size of the contents of the view)
  • fill_parent (applies to the entire size - the width or height of its parent)
+1
source

Layout options are pretty well described in the documentation for ViewGroup.LayoutParams and its subclasses. For a really strong heart, you can always look at the source for attr.xml .

0
source

Source: https://habr.com/ru/post/1339316/


All Articles