0
でフォントの高さを変更することができる私は、このAutoFitTextView使用しています
:http://www.andreamaglie.com/android-auto-fit-textview/私はTextViewに
を、それは、仕事の罰金と示したすべてのテキストとサイズを変更フォントの
問題は、私がしたいです使用可能なスペースがあるため高さを増やします。境界線が表示されるので、スペースがあります。
Javaコード:
PercentRelativeLayout layout = (PercentRelativeLayout) findViewById(R.id.temp_layout);
AutoTxtV txtV = new AutoTxtV(this);
txtV.setMaxLines(1);
txtV.setMinTextSize(1);
txtV.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
txtV.setGravity(Gravity.CENTER_VERTICAL);
txtV.setTextColor(getResources().getColor(R.color.card_name_white));
txtV.setText("HELLO WORLD HELLO WORLD ABCDEFGHIJKLM");
layout.addView(txtV);
XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/parent_layout"
android:layout_width="279dp"
android:layout_height="405dp"
android:background="@drawable/background">
<android.support.percent.PercentRelativeLayout
android:id="@+id/temp_layout"
android:orientation="horizontal"
app:layout_heightPercent="7.5%"
app:layout_marginLeftPercent="7.3%"
app:layout_marginTopPercent="4%"
app:layout_widthPercent="74.5%">
</android.support.percent.PercentRelativeLayout>
</android.support.percent.PercentRelativeLayout>
は、フォントの種類を変更するかもしれない、高さを向上させる方法はありますか?
UPDATE(もっと説明):
問題は、私はサイズを増やす場合は、テキストはそれのすべてを示さないので、フォント「高さ」ではない「サイズ」を増やしたいです。
AutoFitTextView、 "サイズ" (幅と高さ)のサイズを変更します。コンテナーの「幅」が十分でないため、「幅」は単に問題の幅よりも小さくしたいだけです。
)
txt.setTextScaleX(高さを変更するビューまたはTextViewの背後にある任意のレイアウトというのですか? –
@quicklearner要点を更新しました。親はタイプのレイアウトです:PercentRelativeLayout –
あなたはtextviewsの高さを試すのではなく、コンテンツをラップする必要があります –