Output I'm getting
Desired Output
我是Android应用程序开发的新手,我正在一个项目上,我需要显示在XML和JAVA中下面的代码使用过的垂直搜索栏。我想要右侧输出,但是我在设备中得到左侧输出,但是我希望在XML中得到所需的输出,但在设备中却没有。
帮我解决这个问题
对于XML,我使用了以下方法:
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginRight="50dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:paddingTop="9dp"
>
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
android:id="@+id/mySeekBar"
android:layout_width="30dp"
android:layout_height="match_parent"
android:max="100"
android:progress="40”
android:progressTint="@color/color_red"
android:progressBackgroundTint="@color/color_gray"
android:thumb="@drawable/custom_thumb"
android:splitTrack="false"
app:seekBarRotation="CW90" /> <!-- Rotation: CW90 or CW270 -->
对于JAVA,我使用以下代码:
progress =prefs.getInt("PROGRESS", 0);
if (progress == 33) {
verticalSeekBar.setProgress(progress);
tvCooking.setAlpha(1f);
ivCooking.setAlpha:
(1f);
verticalSeekBar.setProgressBackgroundTintList(ColorStateList.valueOf(color_red));
verticalSeekBar.setProgressTintList(ColorStateList.valueOf(color_red));
}
如果(进度== 66){
verticalSeekBar.setProgress(progress);
tvOrderMoved.setAlpha(1f);
ivOrderMoved.setAlpha(1f);
verticalSeekBar.setProgressBackgroundTintList(ColorStateList.valueOf(color_red));
verticalSeekBar.setProgressTintList(ColorStateList.valueOf(color_red));
}
如果(进度== 99){
verticalSeekBar.setProgress(progress);
tvDeliveryDone.setAlpha(1f);
tvDeliveryDone.setAlpha(1f);
verticalSeekBar.setProgressBackgroundTintList(ColorStateList.valueOf(color_red));
verticalSeekBar.setProgressTintList(ColorStateList.valueOf(color_red));
}
verticalSeekBar.setProgress(progress);
如果(orderId!= 0){
verticalSeekBar.setProgress(progress);
verticalSeekBar.setProgressBackgroundTintList(ColorStateList.valueOf(color_red));
verticalSeekBar.setProgressTintList(ColorStateList.valueOf(color_red));
startTimer();
}
}
最佳答案
我认为这是您的利润问题
所以我找到了解决方案
解决方案:-
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
android:layout_width="40dp"
android:layout_height="match_parent"
android:paddingTop="9dp">
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
android:id="@+id/mySeekBar"
android:layout_width="30dp"
android:layout_height="match_parent"
android:max="100"
android:progress="40"
android:progressBackgroundTint="@color/color_gray"
android:progressTint="@color/color_red"
android:splitTrack="false"
android:thumb="@drawable/custom_thumb"
app:seekBarRotation="CW90" /> <!-- Rotation: CW90 or CW270 -->
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
注意:-下面只能运行API级别21或更高
android:progressBackgroundTint="@color/color_dark"
android:progressTint="@color/black"
android:splitTrack="false"
因此下面使用的inteadof将用于所有设备:
android:progressDrawable="@drawable/text_seekbar_progress"
text_seekbar_progress(可绘制文件):-
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/btn_radius" />
<solid android:color="@color/black" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="@dimen/btn_radius" />
<solid android:color="@color/colorAccent" />
</shape>
</clip>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="@dimen/btn_radius" />
<solid android:color="@color/colorAccent" />
</shape>
</clip>
</item>
</layer-list>