怎么使左右两个EditText上下滚动的时候同时进行? 把两个EditText控件放进了一个LinerLayout里面,左右各一个,现在需要实现当右边的EditText里面内容上下滚动的时候左边的edittext的内容也跟着一起同步滚动。求各位高手指导! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用hander实现一个线程,在线程中写方法就OK,,, 这个滚动一般来说,非常的消耗资源,能占cpu的80%-90%,也就是说即使一起滚动,也是多多少少不同步的,不知道为什么这么做?用一个edittext中间加一些占位符不行吗 把两个edittext的ontouch事件绑在一起行不?一个ontouch的时候主动调下另一个的ontouch。 很简单,把两个EditText放在同一个容器里就行,可能还要重写事件传导方法,好久不做Android了,只能给你个思路,具体实现不会的话百度:Android事件传导机制 两个思路:1.在 ScrollView中添加 LinearLayout 和两个 EditTexts。2.EditText 继承 View 中的 scrollTo() 和 onScrollChanged()方法.给第一个 EditText 重写onScrollChanged()方法。在第二个 EditText中调用scrollTo()方法。 <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楼的第一个思路 Android的联系人智能搜索 短信数据库可以增加一个属性吗? 小弟刚学安卓,eclipse加ADT时怎么总出错啊,错误我贴出来 第一次启动初始化GridView对象,如何设置某一项的背景色? Android画图问题 android OpenGL 立方体纹理映射问题 simpleAdatpter可以设置选中效果么。 如何在应用程序后台运行时监听系统广播 android 页面分页 android如何与服务器交互? 关于android线程问题 关于字体的大小的问题
用一个edittext中间加一些占位符不行吗
1.在 ScrollView中添加 LinearLayout 和两个 EditTexts。
2.EditText 继承 View 中的 scrollTo() 和 onScrollChanged()方法.给第一个 EditText 重写onScrollChanged()方法。在第二个 EditText中调用scrollTo()方法。
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楼的第一个思路