把两个EditText控件放进了一个LinerLayout里面,左右各一个,现在需要实现当右边的EditText里面内容上下滚动的时候左边的edittext的内容也跟着一起同步滚动。求各位高手指导!

解决方案 »

  1.   

    用hander实现一个线程,在线程中写方法就OK,,,
      

  2.   

    这个滚动一般来说,非常的消耗资源,能占cpu的80%-90%,也就是说即使一起滚动,也是多多少少不同步的,不知道为什么这么做?
    用一个edittext中间加一些占位符不行吗
      

  3.   

    把两个edittext的ontouch事件绑在一起行不?一个ontouch的时候主动调下另一个的ontouch。
      

  4.   

    很简单,把两个EditText放在同一个容器里就行,可能还要重写事件传导方法,好久不做Android了,只能给你个思路,具体实现不会的话百度:Android事件传导机制
      

  5.   

    两个思路:
    1.在 ScrollView中添加 LinearLayout 和两个 EditTexts。
    2.EditText 继承 View 中的 scrollTo() 和 onScrollChanged()方法.给第一个 EditText 重写onScrollChanged()方法。在第二个 EditText中调用scrollTo()方法。
     
      

  6.   

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" 
        android:layout_width="match_parent"
        android:layout_height="40dp">
        <LinearLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <EditText 
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                />
            
            <EditText 
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                />
        </LinearLayout>
    </ScrollView>
    按8楼的第一个思路