(A) Layout Resources

Click this link for Layouts details

(B) UI Elements

(a) Views & ViewGroup
Views
    • Views are the fundamental building blocks used to create an app’s user interface (UI).
    • Each view represents a visual component that the user can interact with or display information.
    • Views are the fundamental building block/object of the user interface created from the View class.
    • Views is a small/large rectangular area on the screen and is responsible for drawing and event handling in the Android app.
    • View is the base class for widgets, which are used to create interactive UI components like buttons, text fields, etc.
    • Views in Android can be arranged and customized using XML layout files or programmatically through Java or Kotlin code.
    • Some common View elements used in Android applications are:-
      • Basic Views:
        • TextView:
          • TextView is a basic UI widget that displays text to the user.
          • It is one of the most fundamental building blocks for displaying static or dynamic text in Android apps.
          • We can customize its appearance and behavior using various XML attributes.
          • It is a simple text display element.
          • This view displays text on the screen and can be used to show static or dynamically changing text content.
          • It acts as a label.
        • Plain Text
          • In Android, the PlainText widget is used to provide a simple text input field where users can enter single-line text, such as usernames, search queries, or other text inputs.
          • In the Android SDK, this widget is called EditText, but when we see PlainText in the Palette of Android Studio’s Layout Editor, it’s essentially a pre-configured EditText for single-line input.
          • We can customize the behavior of the PlainText field by using different input type values depending on the kind of data we want the user to input.
            • For Single-line text (default): android:inputType=”text”
            • For Email: android:inputType=”textEmailAddress”
            • For Password: android:inputType=”textPassword”
            • For Phone/Mobile number: android:inputType=”phone”
            • For Numeric Value: android:inputType=”number”
          • This view is almost similar to EditText.
        • EditText:
          • It is a user-input text box/field.
          • It’s used for accepting user input such as text, numbers, etc.
        • Password:
          • In Android, the Password input field is created using the EditText widget with a specific inputType that masks the characters as they are typed.
          • The EditText widget allows for secure entry of passwords by displaying dots or asterisks instead of the actual characters. This is done by setting the android:inputType attribute to “textPassword” or “numberPassword”.
          • Android provides a convenient way to toggle the visibility of the password. This can be done using the android:passwordToggleEnabled=”True” feature in conjunction with TextInputLayout. It allows users to see the password when they click an eye icon next to the field.
          • To Limit the number of characters a user can enter for the password using android:maxLength=”30″ .
          • If we want to show error messages when the password is incorrect, we can do so using textInputLayout.setError(“Password must be at least 6 characters long.”);.
        • Button:
          • This view is used to represent a clickable button that triggers an action/event when pressed by the user.
        • ImageView:
          • It is used to display images or drawables on the screen.
      • Container Views:
        • ScrollView:
          • It allows scrolling of the contents if they exceed the screen size.
        • ListView:
          • It displays a scrollable list of items.
        • RecyclerView:
          • It is a more advanced and efficient list view that efficiently displays large sets of data by recycling views.
        • ViewPager:
          • It enables the user to swipe left or right to view different content screens.
        • TabLayout:
          • It represents tabs for switching between different views or sections within an app.
        • Navigation Drawer:
          • It is a sliding panel that displays app navigation options.
      • Interactive Views:
        • CheckBox:
          • It is used to represent a box that can be checked or unchecked by the user.
          • This view is used as multi-select or zero-select options at a time.
        • RadioButton:
          • This view is used to present a set of options where only one can be selected at a time.
        • SeekBar:
          • It is used to display a draggable bar allowing the user to select a value from a range.
      • Specialized Views:
        • DatePicker and TimePicker:
          • It allows users to select dates and times respectively.
        • WebView:
          • It displays web content within the app, allowing for the integration of web-based features.
        • Spinner:
          • It represents a dropdown list allowing users to select one item from multiple options.
        • SeekBar:
          • It provides a draggable thumb to select a value from a range, often used for adjusting settings like volume or brightness.
        • ProgressBar:
          • It indicates the progress of an operation or task that is going on or completed.
ViewGroup
    • The ViewGroup is a subclass of View and provides an invisible container that holds other Views or other ViewGroups and defines their layout properties.
(b) Intent
Click this link for Intents details
(c) Toast
Click this link for Toast details

Loading

Categories: Android

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.