0

これは来ると予想されるものです-----

最初のテキスト ビュー:

フォックス プロ

引っ張る

メイン ビュー アイテム

これは来るものです-----

そして他のテキストビュー:

フォックス プロ

引っ張る

メイン ビュー
アイテム

したがって、テキストが特定の制限まで十分に長い場合、次の行に折り返されます。

この問題は、より高い ppi の 7 インチ デバイス (~213 ppi) でのみ発生することに注意してください。

同じことが、より低いppi 7インチデバイス(〜160 ppi)でもうまくいきます。

幅をフルに設定して、プログラムで次のことを実行しようとしましたmatch_parent-------

DisplayMetrics dm = new DisplayMetrics();

            // Display device dpi value of Y in pixels
            int screenDPIy = (int)dm.ydpi;

            if(screenDPIy > 180)
            {
                entrytype.setTextSize(14);
                entrydate.setTextSize(12);

                entrytype.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                entrydate.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));

            }
            else
            {
                entrytype.setTextSize(16);
                entrydate.setTextSize(14);
            }

失敗。

私のレイアウトxml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/mapentrieslist"
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:background="@drawable/selector"
        android:gravity="left|center_vertical"
        android:orientation="horizontal" >


        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginTop="4dp"
            android:layout_weight="0.9"
            android:orientation="horizontal"
            android:padding="5dp" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="0.47"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/entrytype"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Fox Pro"
                    android:textColor="#000000"
                    android:textSize="16sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/vehicle_source"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="" 
                    android:visibility="gone"/>

                <TextView
                    android:id="@+id/entrydate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=""
                    android:textColor="#989898"
                    android:textSize="14sp" />
            </LinearLayout>
        </LinearLayout>
       </LinearLayout>
      </LinearLayout>
4

1 に答える 1