可以顯示浮動文字提示的ProgressBar或者SeekBar
可以顯示浮動文字提示的ProgressBar或者SeekBar。
運行效果:

使用說明:
1) build.gradle:
repositories { jcenter() maven { url "https://jitpack.io" } } dependencies { compile 'com.github.techery.progresshint:library-addition:{jitpack-release}' }
2) XML
<io.techery.progresshint.addition.widget.SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" app:popupStyle="follow" />
或者
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper android:layout_width="wrap_content" android:layout_height="match_parent" > <io.techery.progresshint.addition.widget.VerticalSeekBar android:layout_width="0dp" android:layout_height="0dp" app:seekBarRotation="CW90" app:popupStyle="follow" app:popupLayout="@layout/custom_seekbar_hint_popup" app:popupAlwaysShown="true" /> <!-- Rotation: CW90 or CW270 --> </com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
可用的屬性:
popupLayout: layout to be used, must include android:id/text1 TextView popupStyle: can be fixed or follow, default follow popupAnimationStyle: in/out animation, default fade popupOffset: distance from top/right of the widget to popup, default 0 popupAlwaysShown: do not dismiss popup after onStopTrackingTouch, default false popupDraggable: enables progress change by hint popup dragging, default true
3) 在java代碼中自定義顯示的文字(可選):
SeekBarHintDelegateHolder seekBar = (SeekBarHintDelegateHolder) findViewById(R.id.seekBar); seekBar.getHintDelegate() .setHintAdapter(new SeekBarHintAdapter() { @Override public String getHint(android.widget.SeekBar seekBar, int progress) { return "Progress: " + String.valueOf(progress); } });
4) 使用Theme屬性(可選):
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="progressHintStyle">@style/Widget.ProgressHint</item> </style>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!