导航:首页 > 操作系统 > android垂直seekbar

android垂直seekbar

发布时间:2023-01-10 02:29:25

android:如何将进度条(SeekBar),竖着布局

读seekbar的源码,将方想反过来即可,在巴士上有现成的,你可以看看这个 http://www.apkbus.com/forum.php?mod=viewthread&tid=82748

㈡ Android开发如何更改SeekBar式样

改变seekbar上的按钮通过设置android:thumb属性

改变seekbar的那个条设置android:progressDrawable属性

示例

按钮图片

<shape>
<solidandroid:color="@android:color/black"/>
<sizeandroid:width="2dp"android:height="10dp"/>
</shape>

进度条图片

<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<itemandroid:id="@android:id/background">
<shape>
<gradient
android:startColor="#1DDA0B"
android:centerColor="#F5DA0B"
android:endColor="#D10000"
android:centerX="0.2"/>
</shape>
</item>
</layer-list>
</item>
</selector>


给seekbar设置属性

<SeekBar
android:id="@+id/seek_aqi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_aqi_text"
android:padding="0dp"
android:thumb="@drawable/seek_aqi_thumb"
android:progressDrawable="@drawable/seek_aqi_bg"
android:max="500"
android:maxHeight="5dp"
android:minHeight="5dp"
android:progress="70"/>

效果

㈢ android 带节点的seekbar怎么搞

sdk里面没有提供设置成垂直的方法 要自己去实现 查看原帖>>

㈣ 求助,Android里面的seekbar怎么垂直显示

把seekbar复写了。。旋转90度就可以了。

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;

public class SlideBar extends SeekBar {

private int oHeight = 100;
private int oWidth = 30;
private int oProgress = -1;
private int oOffset = -1;;
private float xPos = -1;
private float yPos = -1;
private int top = -1;
private int bottom = -1;
private int left = -1;
private int right = -1;

public SlideBar(Context context) {

super(context);
}

public SlideBar(Context context, AttributeSet attrs) {

super(context, attrs);
oOffset = this.getThumbOffset();
oProgress = this.getProgress();
}

public SlideBar(Context context, AttributeSet attrs, int defStyle) {

super(context, attrs, defStyle);
}

protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

int height = View.MeasureSpec.getSize(heightMeasureSpec);
oHeight = height;
this.setMeasuredDimension(oWidth, oHeight);
}

protected void onSizeChanged(int w, int h, int oldw, int oldh) {

super.onSizeChanged(h, w, oldw, oldh);
}

// 设置layout
protected void onLayout(boolean changed, int l, int t, int r, int b) {

super.onLayout(changed, l, t, r, b);
left = l;
right = r;
top = t;
bottom = b;
}

// 画出滚动条
protected void onDraw(Canvas c) {
// 旋转
c.rotate(90);
//控制左右位置
c.translate(0,-30);
super.onDraw(c);
}

public boolean onTouchEvent(MotionEvent event) {

xPos = event.getX();
yPos = event.getY();
float progress = 1-(yPos-this.getTop())/(this.getBottom()- this.getTop());
oOffset = this.getThumbOffset();
oProgress = this.getProgress();
Log.d("offset" + System.nanoTime(), new Integer(oOffset).toString());
Log.d("progress" + System.nanoTime(), new Integer(oProgress).toString());
float offset;
offset = progress * (this.getBottom() - this.getTop());
this.setThumbOffset((int)offset);
Log.d("offset_postsetprogress" + System.nanoTime(), new Integer(oOffset).toString());
Log.d("progress_postsetprogress" + System.nanoTime(), new Integer(oProgress).toString());
// this.setProgress((int)(100*event.getY()/this.getBottom()));
this.setProgress((int)(100 * progress));
return true;
}
}

阅读全文

与android垂直seekbar相关的资料

热点内容
看长篇小说用什么app 浏览:952
部路冲突安卓怎么转到ios 浏览:627
腾讯微云解压用vip吗 浏览:254
服务器启动如何选择默认启动项 浏览:152
河南省服务器托管商云主机物理机 浏览:795
人教版初中数学全套pdf 浏览:666
华为怎么获取定位服务器地址 浏览:607
在什么app上可以制作动漫 浏览:38
服务器11是什么 浏览:424
android源码架构解析 浏览:178
date编译 浏览:871
lru页面调整算法是指 浏览:477
梁柱节点箍筋加密区范围分成三段 浏览:373
命令写入镜像 浏览:241
linux服务器获取不到mac地址 浏览:560
linux网卡名称修改 浏览:667
敲罐子解压声音 浏览:956
深圳市加密图纸 浏览:633
nbspjava 浏览:140
linuxopen返回值 浏览:609