圆形progresbar

package com.example.circleprogressbar;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

public class RoundProgressBar extends View {

public RoundProgressBar(Context context) {
this(context, null);
}

public RoundProgressBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public RoundProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);

paint = new Paint();

TypedArray mTypedArray = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBar);

//获取自定义属性和默认值
roundColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundColor, Color.RED);
roundProgressColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundProgressColor, Color.GREEN);
textColor = mTypedArray.getColor(R.styleable.RoundProgressBar_textColor, Color.GREEN);
textSize = mTypedArray.getDimension(R.styleable.RoundProgressBar_textSize, 15);
roundWidth = mTypedArray.getDimension(R.styleable.RoundProgressBar_roundWidth, 5);
max = mTypedArray.getInteger(R.styleable.RoundProgressBar_max, 100);
textIsDisplayable = mTypedArray.getBoolean(R.styleable.RoundProgressBar_textIsDisplayable, true);
style = mTypedArray.getInt(R.styleable.RoundProgressBar_style, 0);

mTypedArray.recycle();
}
/**
* 画笔对象的引用
*/
private Paint paint;

/**
* 圆环的颜色
*/
private int roundColor;

/**
* 圆环进度的颜色
*/
private int roundProgressColor;

/**
* 中间进度百分比的字符串的颜色
*/
private int textColor;

/**
* 中间进度百分比的字符串的字体
*/
private float textSize;

/**
* 圆环的宽度
*/
private float roundWidth;

/**
* 最大进度
*/
private int max;

/**
* 当前进度
*/
private int progress;
/**
* 是否显示中间的进度
*/
private boolean textIsDisplayable;

/**
* 进度的风格,实心或者空心
*/
private int style;

public static final int STROKE = 0;
public static final int FILL = 1;

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

/**
* 画最外层的大圆环
*/
int centre = getWidth()/2; //获取圆心的x坐标
int radius = (int) (centre - roundWidth/2); //圆环的半径
paint.setColor(roundColor); //设置圆环的颜色
paint.setStyle(Paint.Style.STROKE); //设置空心
paint.setStrokeWidth(roundWidth); //设置圆环的宽度
paint.setAntiAlias(true); //消除锯齿
canvas.drawCircle(centre, centre, radius, paint); //画出圆环

canvas.drawCircle(centre, centre, radius-20, paint);
Log.e("log", centre + "");

/**
* 画进度百分比
*/
paint.setStrokeWidth(0);
paint.setColor(textColor);
paint.setTextSize(textSize);
paint.setTypeface(Typeface.DEFAULT_BOLD); //设置字体
int percent = (int)(((float)progress / (float)max) * 100); //中间的进度百分比,先转换成float在进行除法运算,不然都为0
float textWidth = paint.measureText(percent + "%"); //测量字体宽度,我们需要根据字体的宽度设置在圆环中间

if(textIsDisplayable && percent != 0 && style == STROKE){
canvas.drawText(percent + "%", centre - textWidth / 2, centre + textSize/2, paint); //画出进度百分比
}

/**
* 画圆弧 ,画圆环的进度
*/

//设置进度是实心还是空心
paint.setStrokeWidth(roundWidth); //设置圆环的宽度
paint.setColor(roundProgressColor); //设置进度的颜色
RectF oval = new RectF(centre - radius, centre - radius, centre
+ radius, centre + radius); //用于定义的圆弧的形状和大小的界限

switch (style) {
case STROKE:{
paint.setStyle(Paint.Style.STROKE);
canvas.drawArc(oval, 270, 360 * progress / max, false, paint); //根据进度画圆弧

int pointY=(int) Math.sin(2*Math.PI/360*((360*progress / max+270)%360))*radius+centre;
int pointx=(int) Math.cos(2*Math.PI/360*((360*progress / max+270)%360))*radius+centre;

paint.setStyle(Style.FILL);
paint.setStrokeWidth(1);
canvas.drawCircle(pointx, pointY, roundWidth/2, paint);

break;
}
case FILL:{
paint.setStyle(Paint.Style.FILL_AND_STROKE);
if(progress !=0)
canvas.drawArc(oval, 180, 360 * progress / max, true, paint); //根据进度画圆弧
break;
}
}

}

public synchronized int getMax() {
return max;
}

/**
* 设置进度的最大值
* @param max
*/
public synchronized void setMax(int max) {
if(max < 0){
throw new IllegalArgumentException("max not less than 0");
}
this.max = max;
}

/**
* 获取进度.需要同步
* @return
*/
public synchronized int getProgress() {
return progress;
}

/**
* 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步
* 刷新界面调用postInvalidate()能在非UI线程刷新
* @param progress
*/
public synchronized void setProgress(int progress) {
if(progress < 0){
throw new IllegalArgumentException("progress not less than 0");
}
if(progress > max){
progress = max;
}
if(progress <= max){
this.progress = progress;
postInvalidate();
}

}

public int getCricleColor() {
return roundColor;
}

public void setCricleColor(int cricleColor) {
this.roundColor = cricleColor;
}

public int getCricleProgressColor() {
return roundProgressColor;
}

public void setCricleProgressColor(int cricleProgressColor) {
this.roundProgressColor = cricleProgressColor;
}

public int getTextColor() {
return textColor;
}

public void setTextColor(int textColor) {
this.textColor = textColor;
}

public float getTextSize() {
return textSize;
}

public void setTextSize(float textSize) {
this.textSize = textSize;
}

public float getRoundWidth() {
return roundWidth;
}

public void setRoundWidth(float roundWidth) {
this.roundWidth = roundWidth;
}

}

********************style文件

<!-- 自定义控件属性 -->
<declare-styleable name="RoundProgressBar">
<attr name="roundColor" format="color"/>
<attr name="roundProgressColor" format="color"/>
<attr name="roundWidth" format="dimension"></attr>
<attr name="textColor" format="color" />
<attr name="textSize" format="dimension" />
<attr name="max" format="integer"></attr>
<attr name="textIsDisplayable" format="boolean"></attr>
<attr name="style">
<enum name="STROKE" value="0"></enum>
<enum name="FILL" value="1"></enum>
</attr>
</declare-styleable>

****************************xml 布局文件*************************

<com.example.circleprogressbar.RoundProgressBar
android:id="@+id/rpb"
android:layout_width="match_parent"
android:layout_height="match_parent"

android_custom:roundColor="#D1D1D1"
android_custom:roundProgressColor="@android:color/black"
android_custom:textColor="#9A32CD"
android_custom:textIsDisplayable="false"
android_custom:roundWidth="10dip"
android_custom:textSize="18sp"/>

/>

******************************普通progresbar换背景**************************

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background" >

<shape>

<corners

android:radius="5dip" />

<gradient

android:startColor="#dcdcdc"

android:endColor="#dcdcdc" />

</shape>

</item>

<!-- 设置进度条颜色(白色) -->

<item android:id="@android:id/progress" >

<clip >

<shape>

<corners

android:radius="10dip" />

<gradient

android:startColor="#ff0000"

android:endColor="#ff0000" />

</shape>

</clip>

</item>

</layer-list>

********************************************圆形图片********************************

package com.example.circleimage;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Xfermode;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

public abstract class MaskedImage extends ImageView {

private static final Xfermode MASK_XFERMODE;
private Bitmap mask;
private Paint paint;

static {
PorterDuff.Mode localMode = PorterDuff.Mode.DST_IN;
MASK_XFERMODE = new PorterDuffXfermode(localMode);

}

public MaskedImage(Context paramContext) {
super(paramContext);
}

public MaskedImage(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
}

public MaskedImage(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
}

public abstract Bitmap createMask();

protected void onDraw(Canvas paramCanvas) {
Drawable localDrawable = getDrawable();
if (localDrawable == null)
return;
try {
if (this.paint == null) {
Paint localPaint1 = new Paint();
this.paint = localPaint1;
this.paint.setFilterBitmap(false);
Paint localPaint2 = this.paint;
Xfermode localXfermode1 = MASK_XFERMODE;
@SuppressWarnings("unused")
Xfermode localXfermode2 = localPaint2.setXfermode(localXfermode1);
}
float f1 = getWidth();
float f2 = getHeight();
int i = paramCanvas.saveLayer(0.0F, 0.0F, f1, f2, null, 31);
int j = getWidth();
int k = getHeight();
localDrawable.setBounds(0, 0, j, k);
localDrawable.draw(paramCanvas);
if ((this.mask == null) || (this.mask.isRecycled())) {
Bitmap localBitmap1 = createMask();
this.mask = localBitmap1;
}
Bitmap localBitmap2 = this.mask;
Paint localPaint3 = this.paint;
paramCanvas.drawBitmap(localBitmap2, 0.0F, 0.0F, localPaint3);
paramCanvas.restoreToCount(i);
return;
} catch (Exception localException) {
StringBuilder localStringBuilder = new StringBuilder()
.append("Attempting to draw with recycled bitmap. View ID = ");
System.out.println("localStringBuilder=="+localStringBuilder);
}
}

}

**********************************************musk****************

package com.example.circleimage;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Xfermode;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

public abstract class MaskedImage extends ImageView {

private static final Xfermode MASK_XFERMODE;
private Bitmap mask;
private Paint paint;

static {
PorterDuff.Mode localMode = PorterDuff.Mode.DST_IN;
MASK_XFERMODE = new PorterDuffXfermode(localMode);

}

public MaskedImage(Context paramContext) {
super(paramContext);
}

public MaskedImage(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
}

public MaskedImage(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
}

public abstract Bitmap createMask();

protected void onDraw(Canvas paramCanvas) {
Drawable localDrawable = getDrawable();
if (localDrawable == null)
return;
try {
if (this.paint == null) {
Paint localPaint1 = new Paint();
this.paint = localPaint1;
this.paint.setFilterBitmap(false);
Paint localPaint2 = this.paint;
Xfermode localXfermode1 = MASK_XFERMODE;
@SuppressWarnings("unused")
Xfermode localXfermode2 = localPaint2.setXfermode(localXfermode1);
}
float f1 = getWidth();
float f2 = getHeight();
int i = paramCanvas.saveLayer(0.0F, 0.0F, f1, f2, null, 31);
int j = getWidth();
int k = getHeight();
localDrawable.setBounds(0, 0, j, k);
localDrawable.draw(paramCanvas);
if ((this.mask == null) || (this.mask.isRecycled())) {
Bitmap localBitmap1 = createMask();
this.mask = localBitmap1;
}
Bitmap localBitmap2 = this.mask;
Paint localPaint3 = this.paint;
paramCanvas.drawBitmap(localBitmap2, 0.0F, 0.0F, localPaint3);
paramCanvas.restoreToCount(i);
return;
} catch (Exception localException) {
StringBuilder localStringBuilder = new StringBuilder()
.append("Attempting to draw with recycled bitmap. View ID = ");
System.out.println("localStringBuilder=="+localStringBuilder);
}
}

}

**********************************cirimageview*******************************888

package com.example.circleimage;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;

public class CircularImage extends MaskedImage {
public CircularImage(Context paramContext) {
super(paramContext);
}

public CircularImage(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
}

public CircularImage(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
}

public Bitmap createMask() {
int i = getWidth();
int j = getHeight();
Bitmap.Config localConfig = Bitmap.Config.ARGB_8888;
Bitmap localBitmap = Bitmap.createBitmap(i, j, localConfig);
Canvas localCanvas = new Canvas(localBitmap);
Paint localPaint = new Paint(1);
localPaint.setColor(-16777216);
float f1 = getWidth();
float f2 = getHeight();
RectF localRectF = new RectF(0.0F, 0.0F, 50, 50);
localCanvas.drawOval(localRectF, localPaint);
return localBitmap;

}
}

*************************************quickbar******************************8

package com.droid;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.text.style.TypefaceSpan;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class MyLetterListView extends View {

OnTouchingLetterChangedListener onTouchingLetterChangedListener;
String[] b = {"#","A","B","C","D","E","F","G","H","I","J","K","L"
,"M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
int choose = -1;
Paint paint = new Paint();
boolean showBkg = false;

public MyLetterListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

public MyLetterListView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public MyLetterListView(Context context) {
super(context);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(showBkg){
canvas.drawColor(Color.parseColor("#40000000"));
}

int height = getHeight();
int width = getWidth();
int singleHeight = height / b.length;
for(int i=0;i<b.length;i++){
paint.setColor(Color.WHITE);
paint.setTypeface(Typeface.DEFAULT_BOLD);
paint.setAntiAlias(true);
if(i == choose){
paint.setColor(Color.parseColor("#3399ff"));
paint.setFakeBoldText(true);
}
float xPos = width/2 - paint.measureText(b[i])/2;
float yPos = singleHeight * i + singleHeight;
canvas.drawText(b[i], xPos, yPos, paint);
paint.reset();
}

}

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
final int action = event.getAction();
final float y = event.getY();
final int oldChoose = choose;
final OnTouchingLetterChangedListener listener = onTouchingLetterChangedListener;
final int c = (int) (y/getHeight()*b.length);

switch (action) {
case MotionEvent.ACTION_DOWN:
showBkg = true;
if(oldChoose != c && listener != null){
if(c > 0 && c< b.length){
listener.onTouchingLetterChanged(b[c]);
choose = c;
invalidate();
}
}

break;
case MotionEvent.ACTION_MOVE:
if(oldChoose != c && listener != null){
if(c > 0 && c< b.length){
listener.onTouchingLetterChanged(b[c]);
choose = c;
invalidate();
}
}
break;
case MotionEvent.ACTION_UP:
showBkg = false;
choose = -1;
invalidate();
break;
}
return true;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}

public void setOnTouchingLetterChangedListener(
OnTouchingLetterChangedListener onTouchingLetterChangedListener) {
this.onTouchingLetterChangedListener = onTouchingLetterChangedListener;
}

public interface OnTouchingLetterChangedListener{
public void onTouchingLetterChanged(String s);
}

}

*****************************************mainactivity***************************

package com.droid;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;

import android.app.Activity;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.droid.MyLetterListView.OnTouchingLetterChangedListener;

public class Activity01 extends Activity {
private BaseAdapter adapter;
private ListView personList;
private TextView overlay;
private MyLetterListView letterListView;
private AsyncQueryHandler asyncQuery;
private static final String NAME = "name", NUMBER = "number", SORT_KEY = "sort_key";
private HashMap<String, Integer> alphaIndexer;//存放存在的汉语拼音首字母和与之对应的列表位置
private String[] sections;//存放存在的汉语拼音首字母
private Handler handler;
private OverlayThread overlayThread;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

personList = (ListView) findViewById(R.id.list_view);
letterListView = (MyLetterListView) findViewById(R.id.MyLetterListView01);
letterListView.setOnTouchingLetterChangedListener(new LetterListViewListener());

asyncQuery = new MyAsyncQueryHandler(getContentResolver());
alphaIndexer = new HashMap<String, Integer>();
handler = new Handler();
overlayThread = new OverlayThread();
initOverlay();
}

@Override
protected void onResume() {
super.onResume();
Uri uri = Uri.parse("content://com.android.contacts/data/phones");
String[] projection = { "_id", "display_name", "data1", "sort_key" };
asyncQuery.startQuery(0, null, uri, projection, null, null,
"sort_key COLLATE LOCALIZED asc");
}

//查询联系人
private class MyAsyncQueryHandler extends AsyncQueryHandler {

public MyAsyncQueryHandler(ContentResolver cr) {
super(cr);

}

@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
if (cursor != null && cursor.getCount() > 0) {
List<ContentValues> list = new ArrayList<ContentValues>();
cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) {
ContentValues cv = new ContentValues();
cursor.moveToPosition(i);
String name = cursor.getString(1);
String number = cursor.getString(2);
String sortKey = cursor.getString(3);
if (number.startsWith("+86")) {
cv.put(NAME, name);
cv.put(NUMBER, number.substring(3)); //去掉+86
cv.put(SORT_KEY, sortKey);
} else {
cv.put(NAME, name);
cv.put(NUMBER, number);
cv.put(SORT_KEY, sortKey);
}
list.add(cv);
}
if (list.size() > 0) {
setAdapter(list);
}
}
}

}

private void setAdapter(List<ContentValues> list) {
adapter = new ListAdapter(this, list);
personList.setAdapter(adapter);

}

private class ListAdapter extends BaseAdapter {
private LayoutInflater inflater;
private List<ContentValues> list;

public ListAdapter(Context context, List<ContentValues> list) {
this.inflater = LayoutInflater.from(context);
this.list = list;
alphaIndexer = new HashMap<String, Integer>();
sections = new String[list.size()];

for (int i = 0; i < list.size(); i++) {
//当前汉语拼音首字母
String currentStr = getAlpha(list.get(i).getAsString(SORT_KEY));
//上一个汉语拼音首字母,如果不存在为“ ”
String previewStr = (i - 1) >= 0 ? getAlpha(list.get(i - 1).getAsString(SORT_KEY)) : " ";
if (!previewStr.equals(currentStr)) {
String name = getAlpha(list.get(i).getAsString(SORT_KEY));
alphaIndexer.put(name, i);
sections[i] = name;
}
}
}

@Override
public int getCount() {
return list.size();
}

@Override
public Object getItem(int position) {
return list.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_item, null);
holder = new ViewHolder();
holder.alpha = (TextView) convertView.findViewById(R.id.alpha);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.number = (TextView) convertView.findViewById(R.id.number);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
ContentValues cv = list.get(position);
holder.name.setText(cv.getAsString(NAME));
holder.number.setText(cv.getAsString(NUMBER));
String currentStr = getAlpha(list.get(position).getAsString(SORT_KEY));
String previewStr = (position - 1) >= 0 ? getAlpha(list.get(position - 1).getAsString(SORT_KEY)) : " ";
if (!previewStr.equals(currentStr)) {
holder.alpha.setVisibility(View.VISIBLE);
holder.alpha.setText(currentStr);
} else {
holder.alpha.setVisibility(View.GONE);
}
return convertView;
}

private class ViewHolder {
TextView alpha;
TextView name;
TextView number;
}

}

//初始化汉语拼音首字母弹出提示框
private void initOverlay() {
LayoutInflater inflater = LayoutInflater.from(this);
overlay = (TextView) inflater.inflate(R.layout.overlay, null);
overlay.setVisibility(View.INVISIBLE);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
windowManager.addView(overlay, lp);
}

private class LetterListViewListener implements OnTouchingLetterChangedListener{

@Override
public void onTouchingLetterChanged(final String s) {
if(alphaIndexer.get(s) != null) {
int position = alphaIndexer.get(s);
personList.setSelection(position);
overlay.setText(sections[position]);
overlay.setVisibility(View.VISIBLE);
handler.removeCallbacks(overlayThread);
//延迟一秒后执行,让overlay为不可见
handler.postDelayed(overlayThread, 1500);
}
}

}

//设置overlay不可见
private class OverlayThread implements Runnable {

@Override
public void run() {
overlay.setVisibility(View.GONE);
}

}

//获得汉语拼音首字母
private String getAlpha(String str) {
if (str == null) {
return "#";
}

if (str.trim().length() == 0) {
return "#";
}

char c = str.trim().substring(0, 1).charAt(0);
// 正则表达式,判断首字母是否是英文字母
Pattern pattern = Pattern.compile("^[A-Za-z]+$");
if (pattern.matcher(c + "").matches()) {
return (c + "").toUpperCase();
} else {
return "#";
}
}

}

******************************listItem*********************************

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/alpha"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="13dip"
android:background="#333333"
android:textColor="#99CCFF"
android:textAppearance="?android:textAppearanceMedium"
android:visibility="gone" />

<ImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5.0dip"
android:src="@drawable/contact_list_icon"
android:layout_below="@id/alpha" />

<TextView
android:id="@+id/name"
android:textAppearance="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2.0dip"
android:layout_marginTop="6.0dip"
android:layout_marginRight="5.0dip"
android:singleLine="true"
android:layout_toRightOf="@id/image_view"
android:layout_alignTop="@id/image_view" />

<TextView
android:id="@+id/number"
android:textAppearance="?android:textAppearanceSmall"
android:ellipsize="marquee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#AAAAAA"
android:layout_below="@id/name"
android:layout_alignLeft="@id/name"
android:layout_alignWithParentIfMissing="true" />

</RelativeLayout>

****************************main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<ListView android:id="@+id/list_view"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:scrollbars="none"
android:cacheColorHint="#00000000" />
<com.droid.MyLetterListView
android:id="@+id/MyLetterListView01"
android:background="#40000000"
android:layout_width="30dip"
android:layout_height="fill_parent"
android:layout_alignParentRight="true" />
</RelativeLayout>

***************************overlay.xml*************************************

<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:textSize="70sp"
android:textColor="#3399ff"
android:background="#ffffff"
android:minWidth="80dip"
android:maxWidth="80dip"
android:padding="5dip"
android:gravity="center"
/>

时间: 2024-10-10 00:33:37

圆形progresbar的相关文章

在android中画圆形图片的几种办法

在开发中经常会有一些需求,比如显示头像,显示一些特殊的需求,将图片显示成圆角或者圆形或者其他的一些形状.但是往往我们手上的图片或者从服务器获取到的图片都是方形的.这时候就需要我们自己进行处理,将图片处理成所需要的形状.正如茴香豆的的"茴"写法大于一种,经过我的研究,画出特殊图片的方法也不是一种,我发现了三种,且听我一一道来. 使用Xfermode 两图相交方式 通过查找资料发现android中可以设置画笔的Xfermode即相交模式,从而设置两张图相交之后的显示方式,具体模式见下图,源

Cocos2d-x3.2 碰撞检测--圆形

//GameScene.h #include "cocos2d.h" USING_NS_CC; class GameScene : public cocos2d::Layer { public:     static cocos2d::Scene* createScene();          virtual bool init();          virtual bool onTouchBegan(Touch *touch, Event *unused_event);     

简单圆形碰撞检测

整理以前的文件时看到之前写过的圆形的碰撞检测,简单记录下. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <canvas id="cav" width="500" height=&quo

【转】超简单利用UGUI制作圆形小地图

http://sanwen.net/a/ithhtbo.html 由于UI都是Achor自己用PS做的,比较粗糙,大家见谅,不过丝毫不影响功能的实现,下面我们看看今天的笔记: 首先我们看看需要哪些组件: 1.在Canvas画布下新建一个GameObject,改名为Mask,顾名思义,该组件实现遮罩功能. 2.在Mask下面添加RawImage,用来实现小地图动态显示. 3.新建一个Sprite作为角色的子对象,改名为Icon,实现小地图中代替角色的箭头图标.(贴图大家根据自己喜好来画,这里Ach

CSS之纯CSS画的基本图形(矩形、圆形、三角形、多边形、爱心、八卦等)

图形包括基本的矩形.圆形.椭圆.三角形.多边形,也包括稍微复杂一点的爱心.钻石.阴阳八卦等.当然有一些需要用到CSS3的属性,所以在你打开这篇文章的时候,我希望你用的是firefox或者chrome,当然IE也能看一部分的.那好,下面就一起来看看我们是如何用纯CSS来画这些图形的,如果你也觉得很震撼,推荐给你的朋友吧. 1.正方形 最终效果: CSS代码如下: 复制代码 代码如下: #square { width: 100px; height: 100px; background: red; }

排列组合问题之圆形分布

1.问题1.1 团团坐有一张圆桌,坐了A,B,C,D四个人,已知,D在A的右边,C在D的对面,请问A,B,C,D,的坐次? 解答:这个问题相对简单,我们纸上画一画,就能画出他们的可能的位置了 但是,可能还有一种解,比如我们把A,B,C,D依次右转一个位,也是满足条件的,而且只要保持他们的相对位置不变,依次右转n个位都是问题的解,而且还有个有趣的事情,当他们转了一圈(即右转4个位)后,他们右回到原位了 2.圆形分布上面这个问题就是一种圆形分布,那么他和直线分布的区别在哪里呢?又有什么联系呢?上面文

圆形头像CircleImageView和Cardview使用

效果: 圆形头像在我们的日常使用的app中很常见,因为圆形的头像比较美观. 使用圆形图片的方法可能有我们直接将图片裁剪成圆形再在app中使用, 还有就是使用自定义View对我们设置的任何图片自动裁剪成圆形. 这里使用github上CircleImageView github:https://github.com/hdodenhof/CircleImageView CardView顾名思义卡片式的View, CardView继承的是FrameLayout,所以摆放内部控件的时候需要注意一下 可以设

封装一个UILabel圆形边框显示进度

封装了一个UILabel并让它显示圆形的边框,UILabel上面显示百份比,而边框则用Animation绘制到整个圆占指定百分比的点. 这只是我个人想的继承一个UILabel实现的,用到两个CAShapeLayer,第一个Layer的作用是画出灰色的背影圆圈,第二个Layer位置放置在第一个Layer的上面,并设置为红色描绘颜色并描绘到插定的位置,之后实现相应的动画效果即可. import UIKit class kCircleLabel: UILabel { var percent:Doubl

html5 canvas绘制矩形和圆形

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body onload="draw(),drawarc()"> <!--绘制的步骤:获取canvas元素->取得上下文->填充与绘制边框->设定绘图样式--> <!--绘制其他复杂图