MAD Unit 3
MAD Unit 3
Characteristics of ListView:
Components of ListView:
Types of ListView:
1. Simple ListView : Displays a basic list of text items.
2. Detailed ListView : Displays additional information for each item, such as
icons, images, or multiple lines of text.
3. Grid ListView : Displays items in a grid layout, with multiple columns and
rows.
4. Hierarchical ListView : Displays items in a tree-like structure, with nested
sub-items.
Benefits of ListView:
Web View
WebView is a fundamental component in advanced user interfaces, enabling the
embedding of web content within native applications. It allows developers to display
web pages, HTML content, or even entire web applications within their apps.
Characteristics of WebView:
Components of WebView:
1. Web engine: The core component responsible for rendering web content
(e.g., Blink, Gecko, or WebKit).
2. Rendering area: The visible area where web content is displayed.
3. Navigation controls: Optional buttons or gestures for navigating forward,
backward, or refreshing.
4. JavaScript bridge: Enables communication between native code and web
content.
Types of WebView:
1. JavaScript injection: Allows native code to inject JavaScript into web content.
2. Native-to-web communication: Enables web content to interact with native
code.
3. Web-to-native communication: Allows web content to call native functions.
4. Geolocation support: Provides location-based services to web content.
5. Camera and microphone access: Grants web content access to device
hardware.
6. Cookie management: Handles cookies and session management.
7. SSL/TLS support: Ensures secure communication between web content and
servers.
Benefits of WebView:
Characteristics of ScrollView:
1. Content container: Holds and manages content that exceeds the visible area.
2. Scrollable: Enables users to scroll through content using gestures, mouse
wheels, or scrollbars.
3. Dynamic content: Supports dynamic content loading, updating, and resizing.
4. Customizable: Allows developers to customize appearance, behavior, and
functionality.
Components of ScrollView:
Types of ScrollView:
Benefits of ScrollView:
1. Optimize content size: Ensure content fits within the scrollable area.
2. Use scroll indicators: Provide visual cues for scrolling.
3. Customize scrollbar appearance: Match scrollbar design to the application's
style.
4. Handle scroll events: Respond to scroll events for dynamic content loading
or animations.
5. Test scrolling performance: Ensure smooth scrolling across devices and
platforms.
Fig: TabHost
What is TabHost?
TabHost is a container widget that hosts multiple tabs, each representing a different
view or activity. It provides a simple way to organize content into separate sections,
making it easier for users to navigate.
Components of TabHost
1. Tabs: These are the individual buttons or labels that represent each view or
activity.
2. TabWidget: This is the container that holds the tabs.
3. FrameLayout: This is the container that holds the content of each tab.
4. TabContentFactory: This is an interface that provides the content for each
tab.
Example Code
XML
<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</TabHost>
Java
public class MainActivity extends Activity {
private TabHost tabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tabHost = (TabHost) findViewById(R.id.tabhost);
tabHost.setup();
In this example, we define a TabHost with two tabs, each with its own content.
Settings screens
Dashboard interfaces
News or media apps with multiple sections