点击HorizontalScrollView中的EditText的问题

XiaoYi96 2017-09-20 09:29:19
安卓开发中点击HorizontalScrollView中的EditText后,HorizontalScrollView自己滚动到最右边了,这该怎么解决?
...全文
296 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jing丶無雙 2017-09-21
  • 打赏
  • 举报
回复
我这么简单的写了个XML布局,点击EditText后,HorizontalScrollView并不会自己滚动到最右边啊??看看你的代码喃
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <EditText
                android:layout_width="200dp"
                android:layout_height="50dp"
                android:hint="这里输入" />

            <TextView
                android:layout_width="700dp"
                android:layout_height="50dp"
                android:background="#708090" />
        </LinearLayout>
    </HorizontalScrollView>

</LinearLayout>
XiaoYi96 2017-09-21
  • 打赏
  • 举报
回复
引用 1 楼 xj396282771 的回复:
我这么简单的写了个XML布局,点击EditText后,HorizontalScrollView并不会自己滚动到最右边啊??看看你的代码喃
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <EditText
                android:layout_width="200dp"
                android:layout_height="50dp"
                android:hint="这里输入" />

            <TextView
                android:layout_width="700dp"
                android:layout_height="50dp"
                android:background="#708090" />
        </LinearLayout>
    </HorizontalScrollView>

</LinearLayout>
已经没事了,我自己解决了,谢谢啦

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧