开发者

Top of Android superscript being clipped

I tried and searched for a solution to this problem to no avail. The top of letters, such as the tail in a lower-case "d" are being clipped off. Here's is what I currently have:

Codewise:

From the onClickHandler.....

String selected开发者_运维百科order = ""; ... if (num_players == 3) { editor.putString("prefPrefp3_name", child.getText().toString()); selectedorder = "3rd";} ... order.setText(Html.fromHtml(selectedorder));

From the CursorAdapter BindView.................

        TextView tv4 = (TextView) view.findViewById(R.id.dspplyrorder); 
        tv4.setText(Html.fromHtml(playersCursor.getString(PlayerOrder)));

And from the XML, where I'm trying to get @+id/dspplyrorder to NOT CLIP the tail of the "d" in my superscript...................

<LinearLayout android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView android:id="@+id/dsp_id"
            android:layout_width="120dip"
            android:layout_height="wrap_content"/>
        <TextView android:id="@+id/dspplyrname"
            android:layout_width="180dip"
            android:textColor="#7CFC00"
            android:textStyle="italic"
            android:layout_marginRight="20dip"
            android:layout_marginLeft="20dip"
            android:paddingRight="3dp"
            android:gravity="left"      
            android:textSize="25sp"
            android:layout_height="wrap_content"/>
        <TextView android:id="@+id/dspplyrorder"
            android:layout_width="30dip"
            android:gravity="left"
            android:textColor="#FFFFFF"      
            android:textSize="16sp"
            android:layout_height="wrap_content"/>
        <ToggleButton android:id="@+id/button_toggle"
            android:text="@string/buttons_1_toggle"
            android:textOff="Select"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:onClick="myClickHandler" />
  </LinearLayout>

I am not worried about affecting the line spacing of lines above or below, which seems to be the most often occurring problem discussion. I must be doing something really dump, since no one else seems to have this problem. HELP Please.


This solution worked for me.

Superscripted text is usually made smaller when the browser renders it, that doesn't seem to happen here so you can replicate that (and solve this problem) by doing this:

someTextView.setText(Html.fromHtml("Some text<sup><small>1</small></sup>"));


Set the following for your TextView:

android:setIncludeFontPadding="true"

That should do it. Cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜