TextView is used to display text to the user<TextView android:text="Welcome Student"/>EditText is used to take input from the user<EditText android:hint="Enter your name"/>Button is used to perform an action when clicked<Button android:text="Submit"/>Spinner is a dropdown list used to select one option from multiple options<Spinner/>CheckBox is used to select multiple optionschecked and unchecked<CheckBox android:text="I Agree"/>RadioButton is used to select only one option from multiple optionsRadioGroup<RadioGroup>
<RadioButton android:text="Male"/>
<RadioButton android:text="Female"/>
</RadioGroup>ScrollView is used to scroll screen up and down.Switch is needed when only two options are available.ON or OFF. It improves user experience and makes the app easy to use.ON/OFF.<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WiFi"/>DatePicker is used to select date.TimePicker is used to select time.ProgressBar is used to show the progress of a task.ProgressBar → user thinks app is frozenProgressBar → user sees progressProgressBar:
SeekBar is a slider used to select a value by dragging.RatingBar allows users to give ratings using stars.★★★★☆
Chronometer is a timer used to measure elapsed time.00:00 → 00:30 → 01:00
Vertical → elements in a columnHorizontal → elements in a row
TextView
TableRow to define each row
Features
Fragment Lifecycle
onAttach() – Fragment is attached to ActivityonCreate() – Initialize fragmentonCreateView() – Inflate layoutonViewCreated() – View is createdonStart() – Fragment becomes visibleonResume() – Fragment is activeonPause() – Fragment pausedonStop() – Fragment stoppedonDestroyView() – View destroyedonDestroy() – Fragment destroyedonDetach() – Fragment detached from ActivityAdvantages
Disadvantages
The Android Support Package for Fragments provides a way to use Fragments on older Android versions (before Android 3.0).
Although Fragments were introduced in Android 3.0 (API level 11), many devices ran older versions. The support package allows developers to use Fragments consistently across all versions.
The Fragment Support Package is part of the Android Support Libraries that provides backward-compatible Fragment APIs for older Android devices.
Key Classes in Support Package
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
}TextView and EditText in Android.Spinner and RadioButton?ProgressBar and SeekBar.LinearLayout?CheckBox, Switch and RadioButton with example.DatePicker and TimePicker in Android.Made By SOU Student for SOU Students