Battery Indicator
Battery Indicator:
Battery status bar in android also contains a graphical battery icon in the status bar that represents the current battery level and status of the device.
Battery icon: This is usually displayed on the top end of the screen or within the status bar to communicate the charge level remaining on the battery.
Example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BatteryIndicatorExample"
android:padding="16dp"
android:gravity="center"
android:background="@color/colorWhite"
android:orientation="vertical">
<TextView
android:id="@+id/batterylevel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/colorBlack"
android:textSize="30sp"
android:gravity="center"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:max="100"
android:minHeight="40dp"
android:minWidth="200dp"/>
</LinearLayout>