Just going through the starting tutorials, and while I got the app running fine, I just want to make sure I have the Android terminology right.
For example, the first app tutorial I went through has you modify the activity_main.xml to include:
<EditText android:id="@+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:onClick="sendMessage" />
Am I correct in understanding that these (EditText, Button) elements themselves are individual Views? In other words, the above code contains two “Views”, and not two “controls”? Later in the code we run into something called a TextView, which directly has the word “View” in it, while the others do not, which kinda threw me off.
My only other experience is in ASP.Net and C# web development, so I guess my question could be phrased as, are Android “Views” equivalent to ASP.Net Web Controls (asp:DropDownList, asp:Button, etc.)? If I wanted to add more controls to the above code, like more Buttons for example, would I say, “I’m going to add more Views to this Layout?” Or would it be, “I’m going to add more controls to this View?” Or…?
A view is basically anything displayed on the screen, whether it be a button, a piece of text, a list…
Your complete layout is a view, and each item contained within it is a view as well.
In the above, the RelativeLayout, LinearLayout, TextView, EditText and Buttons are all “views”. LinearLayout and RelativeLayout being container views, but they can still be referenced as views in order to perform certain functions on them.