Android 使文本大小调整为编辑文本
我有以下代码:Android 使文本大小调整为编辑文本,android,layout,text,android-linearlayout,Android,Layout,Text,Android Linearlayout,我有以下代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="@string/tip_value" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="@string/tip_value" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="@string/tip_value" />
</LinearLayout>
如何根据编辑文本的高度调整文本大小
我的意思是大写字母跨越编辑文本的整个高度(由于linearLayout的原因,大小可能不同)
提前谢谢 您需要检查
列表视图中每个视图的高度,并定义该特定视图的文本大小。为此,您必须使用自定义适配器在列表视图中显示数组
或数组列表
(或光标
…)。在getView()
下的自定义适配器中,您可以执行convertView.getHeight()
以获取特定视图的精确高度(以像素为单位),然后在getView()
中设置该视图的textView
大小。应该与此类似:
(我没有检查此代码,我正在为您编写此代码作为示例)
我想你的问题是这样的
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>
但我想让它们“有分量”。跨越整个空间。。在你的例子中,我确实需要设置textSize,它不会调整到屏幕。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="please Enter" />
</LinearLayout>