Water Surface ripple View -- third-party open source -- WaveView (power, energy, capacity indication), view ---- waveview
In some common APP development, this kind of WaveView vividly shows how much power is remaining on the mobile phone and how much storage capacity is available.
The project home page of WaveView on github is: https://github.com/john990/WaveView
Code:
Activity_main.xml:
1 <FrameLayout xmlns: android = "http://schemas.android.com/apk/res/android" 2 xmlns: wave = "http://schemas.android.com/apk/res-auto" 3 android: layout_width = "match_parent" 4 android: layout_height = "match_parent"> 5 6 <! -- Wave: above_wave_color --> 7 <! -- Wave: The color of the waveform defined by blow_wave_color, under the top waveform plane --> 8 <! -- Wave_height defines the height of the wave --> 9 <! -- Wave_hz defines the frequency of wave fluctuations in Hz. --> 10 <! -- Wave_length defines the length of the wave --> 11 <! -- Wave: SS is an integer value. 0-100,100 indicates the highest wave, and 0 indicates the lowest wave --> 12 13 <com.john.wav eview. waveView14 android: id = "@ + id/wave_view" 15 android: layout_width = "match_parent" 16 android: layout_height = "match_parent" 17 android: background = "#1565C0" 18 wave: blow_wave_color = "# 1A237E" 19 wave: progress = "60" 20 wave: wave_height = "large" 21 wave: wave_hz = "normal" 22 wave: wave_length = "middle"/> 23 24 <SeekBar25 android: id = "@ + id/seek_bar" 26 android: layout_width = "match_parent" 27 android: layout_height = "wrap_content" 28 android: layout_gravity = "bottom | center_horizontal" 29 android: layout_marginBottom = "20dp" 30 android: progress = "60"/> 31 32 </FrameLayout>
MainActivity:
1 package com.zzw.testwaveview; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.widget.SeekBar; 6 7 import com.john.waveview.WaveView; 8 9 public class MainActivity extends Activity {10 11 private SeekBar seekBar;12 private WaveView waveView;13 14 public void onCreate(Bundle savedInstanceState) {15 super.onCreate(savedInstanceState);16 setContentView(R.layout.activity_main);17 18 seekBar = (SeekBar) findViewById(R.id.seek_bar);19 waveView = (WaveView) findViewById(R.id.wave_view);20 21 seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {22 @Override23 public void onProgressChanged(SeekBar seekBar, int progress,24 boolean fromUser) {25 waveView.setProgress(progress);26 }27 28 @Override29 public void onStartTrackingTouch(SeekBar seekBar) {30 31 }32 33 @Override34 public void onStopTrackingTouch(SeekBar seekBar) {35 36 }37 });38 }39 }