두 부분으로 구성된 머리글과 본문이있는 레이아웃이 있습니다. 헤더는 TextView와 이미지를 포함합니다. 프로그래밍 방식으로 머리글 높이를 변경할 수 있습니다. 헤더의 이미지와 텍스트는 각각 크기를 조정해야합니다. 이미지 크기 조정은 괜찮지 만 텍스트는 크기 조정을 원하지 않습니다. Android에서 가능하고 어떻게 할 수 있습니까?TextView 글꼴 크기 자동 조절
내 레이아웃 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UseCompoundDrawables" >
<TextView
android:id="@+id/title_text"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/app_name" />
<ImageView
android:id="@+id/edit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/edit"
android:src="@drawable/widget_edit" />
</LinearLayout>
<TextView
android:id="@+id/content_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
아니요 xml을 사용할 수 없습니다. 당신은 아이폰의 scaleToFit을 참조하십시오 –
시도해보십시오 http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds/17782522#17782522 –