如何以编程方式将sup编号添加到TextView?

时间:2018-07-11 18:06:32

标签: java android textview rows android-tablelayout

如何将那个小数字放在同一列(textView)中,或者如何将其中两个相加。 我已经尝试过将linearlayout设置为horizantal,但是它没有用。  ı want to add number like this image

        //this my textView for adding to rows        
        txtColumnArray[i] = new TextView(this);
        txtColumnArray[i].setTextColor(Color.BLUE);
        txtColumnArray[i].setAllCaps(true);
        txtColumnArray[i].setGravity(Gravity.CENTER);
        txtColumnArray[i].setTypeface(Typeface.DEFAULT.DEFAULT_BOLD);
        txtColumnArray[i].setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);

       // my last try is spanable but it is not working , I thought it may be 
      // coz of textView properties but couldnt find it.

        spanableForQuestionNumbers[questionNumbersCount] = new SpannableString(questionNumbersCount + " " + LetterFormat[count]);
        spanableForQuestionNumbers[questionNumbersCount].setSpan(new SuperscriptSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

        txtColumnArray[i].setText(spanableForQuestionNumbers[questionNumbersCount]);
        trCrosswordRow.addView(txtColumnArray[i]);

0 个答案:

没有答案