Android 上标顶部被裁剪

发布于 2024-11-16 07:17:06 字数 2062 浏览 3 评论 0原文

我尝试并寻找解决此问题的方法但无济于事。字母的顶部,例如小写“d”的尾部被剪掉。这是我目前拥有的:

Codewise:

来自 onClickHandler.....

String selectedorder = ""; ... if (num_players == 3) { editor.putString("prefPrefp3_name", child.getText().toString()); selectedorder = "第三rd";} ... order.setText(Html.fromHtml(selectedorder));

从 CursorAdapter BindView ............

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

以及从 XML,我试图让 @+id/dspplyrorder 不剪辑我的“d”的尾部上标......................

<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 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 selectedorder = "";
...
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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌梦深 2024-11-23 07:17:06

这个解决方案对我有用。

当浏览器渲染时,上标文本通常会变小,这似乎不会发生在这里,因此您可以通过执行以下操作来复制它(并解决此问题):

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

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>"));
旧时光的容颜 2024-11-23 07:17:06

为您的 TextView 设置以下内容:

android:setIncludeFontPadding="true"

应该可以了。干杯!

Set the following for your TextView:

android:setIncludeFontPadding="true"

That should do it. Cheers!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文