Android アプリを作成していますが、テキストの最後の数ピクセルが切り捨てられることがあります。アプリのさまざまな部分のいくつかの異なるコントロールで発生しています。これは、エミュレーターと私の電話の両方で発生します。
以下はレイアウトの一部です。背景色を追加したので、親レイアウトが全長を占めているのに、テキスト ビューがコンテキストを正しくラップしていないことがわかります。
下部の「r」の後には明らかにギャップがありますが、上部の「a」はわずかに切り捨てられています。レイアウトはこちら
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center" android:background="#fbff18">
<TextView android:id="@+id/SongRowSongName"
android:gravity="left"
android:layout_gravity="left"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#ff1217"/>
<TextView android:id="@+id/SongRowArtistName"
android:gravity="left"
android:layout_gravity="left"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:linksClickable="false"
android:background="#ff1217" android:clickable="false"/>
</LinearLayout>
textview で幅を full_parent に設定できることはわかっていますが、これは問題の 1 つの例にすぎず、なぜそうしなければならないのかわかりません。それが起こっている他の主な場所は、私のタブホストです。
intent = new Intent().setClass(this, ProfileActivity.class);
spec = tabHost.newTabSpec("profile").setIndicator("Profiles",
res.getDrawable(R.drawable.ic_tab_profile))
.setContent(intent);
tabHost.addTab(spec);
これは私が背景画像セレクターとして使用しているものです
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/profile_grey" android:state_selected="true" />
<!-- When not selected, use white-->
<item android:drawable="@drawable/profile_white" />
</selector>
親に十分なスペースがあると、コンテンツが正しくラップされない理由がわかりません。