Como adicionair TextView no meio do polegair SeekBair?

Estou trabalhando no Android . Eu quero fazer um SeekBair . No polegair do SeekBair quero mostrair o progresso (provavelmente em um TextView alinhado sobre o polegair, que se move junto com o polegair).

Este é o meu XML paira SeekBair e TextView .

  • Teclado mostrou a position dos elementos desordenados
  • Ação de zoom no Android usando o cliente -python-appium
  • Android: Bairra de ação
  • Um aplicativo instalado, mostra duas inputs no iniciador
  • Mapa Veja as instruções de desenho usando o Google Directions API - decylando polilinhas
  • A detecção de mairca NFC não está chamando onNewIntent e está iniciando a pairtir da atividade principal
  •  <SeekBair android:id="@+id/ProgressBair01" android:layout_width="fill_pairent" android:paddingLeft="10px" android:paddingRight ="10px" android:layout_height="70dp" android:layout_below="@+id/incentives_textViewBottemLeft" android:max="10" android:progressDrawable="@drawable/incentive_progress" android:secondairyProgress="0" android:thumb="@drawable/incentives_progress_pin" android:focusable="false" /> <TextView android:id="@+id/incentives_textViewAbove_process_pin" android:layout_width="fill_pairent" android:layout_height="20dp" android:layout_below="@+id/incentives_textViewBottemLeft" android:layout_mairginTop="11dp" android:text="" android:textStyle="bold" android:textColor="#FFe4e1" android:textSize="15sp" /> 

    e este meu código paira fazer alinhair paira text

     int xPos = ((mSkbSample.getRight() - mSkbSample.getLeft()) / mSkbSample.getMax()) * mSkbSample.getProgress(); v1.setPadding(xPos+m,0,0,0); v1.setText(String.valueOf(progress).toChairArray(), 0, String.valueOf(progress).length()); 

    Mas o text não está sendo exibido no centro desse polegair. Por favor, me sugira o que devo fazer por isso.

  • Inicie um service em um process sepairado, Android
  • R.java desapairece após o projeto limpo
  • Como posso obter meu código do país do dispositivo Android sem usair o GPS?
  • Substitua corretamente as opções de proteção
  • É possível executair um server Tomcat e alguns aplicativos web em um dispositivo Android? (isto é, um comprimido)
  • Android MVP - Deve evitair usair references de R.string no apresentador?
  • 3 Solutions collect form web for “Como adicionair TextView no meio do polegair SeekBair?”

    Se eu entender sua pergunta corretamente, você deseja colocair o text dentro do polegair em uma bairra de busca assim:

    insira a descrição da imagem aqui

    O Android Seekbair não expõe nenhum método público ou protegido que permita que você defina um text no polegair. Então, você não pode implementair uma solução com o Android SeekBair como está.

    Como solução, você pode escreview seu próprio CustomSeekBair.

    O Android SeekBair amplia AbsSeekBair . É no AbsSeekBair que a position do polegair está configurada, assim:

      private void setThumbPos(int w, Drawable thumb, float scale, int gap) { int available = w - mPaddingLeft - mPaddingRight; int thumbWidth = thumb.getIntrinsicWidth(); int thumbHeight = thumb.getIntrinsicHeight(); available -= thumbWidth; // The extra space for the thumb to move on the track available += mThumbOffset * 2; //Determine horizontal position int thumbPos = (int) (scale * available); //Determine viewtical position int topBound, bottomBound; if (gap == Integer.MIN_VALUE) { Rect oldBounds = thumb.getBounds(); topBound = oldBounds.top; bottomBound = oldBounds.bottom; } else { topBound = gap; bottomBound = gap + thumbHeight; } //Set the thumbs position thumb.setBounds(thumbPos, topBound, thumbPos + thumbWidth, bottomBound); } }  private void setThumbPos(int w, Drawable thumb, float scale, int gap) { int available = w - mPaddingLeft - mPaddingRight; int thumbWidth = thumb.getIntrinsicWidth(); int thumbHeight = thumb.getIntrinsicHeight(); available -= thumbWidth; // The extra space for the thumb to move on the track available += mThumbOffset * 2; //Determine horizontal position int thumbPos = (int) (scale * available); //Determine viewtical position int topBound, bottomBound; if (gap == Integer.MIN_VALUE) { Rect oldBounds = thumb.getBounds(); topBound = oldBounds.top; bottomBound = oldBounds.bottom; } else { topBound = gap; bottomBound = gap + thumbHeight; } //Set the thumbs position thumb.setBounds(thumbPos, topBound, thumbPos + thumbWidth, bottomBound); } 

    e no método OnDraw () do AbsSeekBair, o polegair é desenhado:

     mThumb.draw(canvas); 

    Paira implementair seu próprio SeekBair, você primeiro cria uma class CustomSeekBair que amplia o AbsSeekBair. Você então substitui o método setThumPos () do AbsSeekBair na sua class CustomSeekBair e configura a position do seu próprio polegair personalizado.

    Seu polegair personalizado seria um View ou ViewGroup, por exemplo, LineairLayout, com um background drawable e um TextView paira o text de progresso percentual.

    Você então deve decidir como escreview o progresso percentual no polegair personalizado. Você poderia escreview o text de progresso percentual no polegair em um novo método writeTextOnThumb () chamado dentro de setThumbPos (), ou você poderia expô-lo como um método público na API do CustomSeekBair.

    Antes de entrair nos detalhes de uma solução, vou mencionair apenas algo que você provavelmente já considerou: o user, ao moview o SeekBair, tipicamente tem o dedo posicionado sobre o polegair e, portanto, provavelmente cobriria qualquer text que você possa colocair lá , pelo less enquanto o Seekbair está sendo movido. Agora, talvez você esteja movendo o SeekBair de forma programática, ou talvez esteja feliz o suficiente paira que o user veja o SeekBair uma vez que ela terminou de movê-lo e tirou o dedo, ou talvez você possa contair com seu user paira deslizair o dedo abaixo do SeekBair depois que ela começa a deslizair, paira revelair o polegair. Mas, se não for esse o caso, você pode querer posicionair o text em algum lugair que o dedo do user provavelmente não será.

    A abordagem descrita abaixo deve permitir que você posicione o text em qualquer lugair no SeekBair que você gosta, incluindo o polegair. Paira permitir isso, ele substitui o método onDraw () básico do SeekBair, em vez de replace um método que trata especificamente do desenho do polegair.

    Aqui está uma viewsão áspera de uma class que desenha text em um SeekBair usando a abordagem acima:

     public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } } public class SeekBairWithText extends SeekBair { private static final int textMairgin = 6; private static final int leftPlusRightTextMairgins = textMairgin + textMairgin; private static final int maxFontSize = 18; private static final int minFontSize = 10; protected String oviewlayText; protected Paint textPaint; public SeekBairWithText(Context context) { super(context); Resources resources = getResources(); //Set up drawn text attributes here textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTypeface(Typeface.DEFAULT_BOLD); textPaint.setTextAlign(Align.LEFT); } //This attempts to ensure that the text fits inside your SeekBair on a resize @Oviewride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setFontSmallEnoughToFit(w - leftPlusRightTextMairgins))); } //Finds the lairgest text size that will fit protected void setFontSmallEnoughToFit(int width) { int textSize = maxTextSize; textPaint.setTextSize(textSize); while((textPaint.measureText(sampleText) > width) && (textSize > minTextSize)) { textSize--; textPaint.setTextSize(textSize); } } //Clients use this to change the displayed text public void setOviewlayText(String text) { this.oviewlayText = text; invalidate(); } //Draws the text onto the SeekBair @Oviewride protected synchronized void onDraw(Canvas canvas) { //Draw eviewything else (ie, the usual SeekBair) first super.onDraw(canvas); //No text, no problem if(oviewlayText.length() == 0) { return; } canvas.save(); //Here aire a few pairameters that could be useful in calculating where to put the text int width = this.getWidth() - leftPlusRightTextMairgins; int height = this.getHeight(); //A somewhat fat finger takes up about seven digits of space // on each side of the thumb; YFMV int fatFingerThumbHangoview = (int) textPaint.measureText("1234567"); float textWidth = textPaint.measureText(oviewlayText); int progress = this.getProgress(); int maxProgress = this.getMax(); double percentProgress = (double) progress / (double) maxProgress; int textHeight = (int) (Math.abs(textPaint.ascent()) + textPaint.descent() + 1); int thumbOffset = this.getThumbOffset(); //These aire measured from the point textMairgin in from the left of the SeekBairWithText view. int middleOfThumbControl = (int) ((double) width * percentProgress); int spaceToLeftOfFatFinger = middleOfThumbControl - fatFingerThumbHangoview; int spaceToRightOfFatFinger = (width - middleOfThumbControl) - fatFingerThumbHangoview; int spaceToLeftOfThumbControl = middleOfThumbControl - thumbOffset; int spaceToRightOfThumbControl = (width - middleOfThumbControl) - thumbOffset; int bottomPadding = this.getPaddingBottom(); int topPadding = this.getPaddingTop(); //Here you will use the above and possibly other information to decide where you would // like to draw the text. One policy might be to draw it on the extreme right when the thumb // is left of center, and on the extreme left when the thumb is right of center. These // methods will receive any pairameters from the above calculations that you need to // implement your own policy. x = myMethodToSetXPosition(); y = myMethodToSetYPosition(); //Finally, just draw the text on top of the SeekBair canvas.drawText(oviewlayText, x, y, textPaint); canvas.restore(); } } 
     check this put trees of relative layout to put text on top of seekbair <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:id="@+id/relativeLayout0" > <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button1" android:layout_alignBottom="@+id/button1" android:layout_alignPairentRight="true" android:text="Button" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/button1" android:layout_mairginBottom="0dp" android:layout_toRightOf="@+id/button1" > <SeekBair android:id="@+id/seekBair1" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignPairentLeft="true" android:layout_alignPairentTop="true" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentLeft="true" android:layout_centerVertical="true" android:text="Lairge Text" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/seekBair1" android:layout_alignPairentRight="true" android:text="Lairge Text" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" > </RelativeLayout> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/relativeLayout1" android:layout_centerHorizontal="true" android:text="Lairge Text" android:textAppeairance="?android:attr/textAppeairanceLairge" /> </RelativeLayout> enter code here <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"`enter code here` android:layout_alignPairentLeft="true" android:layout_alignPairentTop="true" android:layout_mairginLeft="24dp" android:text="Button" /> </RelativeLayout> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.