android-ScrollView中嵌套EditText使用问题

在Android中,ScrollView嵌套EditText时会出现显示异常,如过长拉伸、文字错乱。通过设置EditText的最大高度解决长内容滚动,并通过调整`android:windowSoftInputMode`属性来防止输入法弹出时EditText被遮挡。总结了解决方案:1. 设置EditText可滚动且最大高度;2. 修改Activity的`windowSoftInputMode`为`adjustPan`。
摘要由CSDN通过智能技术生成

直接上布局文件

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:orientation="vertical" >

        ....

        <RelativeLayout
            android:id="@+id/ll_title"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="12dp"
            android:background="@drawable/fans_list_item_selector" >
			.....
        </RelativeLayout>

        <LinearLayout
            android:id="@+id/ll_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:background="@drawable/fans_list_item_selector"
            android:orientation="vertical" >

            <span style="color:#ff6666;"><EditText
                android:id="@+id/ev_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:alpha="0.65"
                android:background="@null"
                android:gravity="top"
                android:hint="@string/new_post_content_hint"
                android:textColorHint="#4c000000"
                android:minLines="4"
                android:textColor="@color/forum_text_color_black"
                android:textCursorDrawable="@null"
                android:textSize="12sp" /></span>
            

            <TextView
                android:id="@+id/tv_phone_info"
          
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值