Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使文本大小调整为编辑文本_Android_Layout_Text_Android Linearlayout - Fatal编程技术网

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>