In Android ,we use various widgets for creating an activity.Before that lets come to"Activity".
XML BASED LAYOUTS IN ANDROID
Android uses xml based layouts for designing an activity.These layout files are reside inside res/layout directory.Each Xml file contains a tree of elements specifying a layout of widgets and containers.
sample
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
Here layout_width,layout_height,text etc are the attributes. android:layout_width="fill_parent" tell android to have the textview's width fill the parent--means entire screen.
Check this in your emulator and find out the difference between "fill parent" and "wrap content".
WHAT IS AN ACTIVITY ?
Activities are the building blocks of the user interface.It is similar to form in html.Generally they are public classes inheriting from android.Activity base class.
When an activity is started, the onCreate() method is invoked. We will come to that point later.
Various Widgets in Android are:
1:TextView(simialr to label in HTML).
2:Button:(Same as in HTML).
3:Spinner(Similar to dropdown in HTML).
4:EditText(Similar to Textbox in HTML).
5:RadioButton etc.................................................................
XML BASED LAYOUTS IN ANDROID
Android uses xml based layouts for designing an activity.These layout files are reside inside res/layout directory.Each Xml file contains a tree of elements specifying a layout of widgets and containers.
sample
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
Here layout_width,layout_height,text etc are the attributes. android:layout_width="fill_parent" tell android to have the textview's width fill the parent--means entire screen.
Check this in your emulator and find out the difference between "fill parent" and "wrap content".
0 comments: