80,350
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBack"
tools:context="com.example.administrator.ChatActivity">
<!--这是自定义的AtionBar,这部分也会被顶出布局-->
<include layout="@layout/namebar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<!--这里是要显示的内容,我希望的效果是点击EditText后只有这部分上移-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycleview_message"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!--这个布局里包括EditText-->
<include layout="@layout/sendbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/include_send"/>
</ScrollView>
</LinearLayout>
[/quote]
你的代码不全,给你写了个案例,你运行下就知道效果了:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_scroll_view_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.apptest.activity.other.ScrollViewLayoutAct">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:hint="第一栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第二栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第三栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第四栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第五栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第六栏" />
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBack"
tools:context="com.example.administrator.ChatActivity">
<!--这是自定义的AtionBar,这部分也会被顶出布局-->
<include layout="@layout/namebar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<!--这里是要显示的内容,我希望的效果是点击EditText后只有这部分上移-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycleview_message"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!--这个布局里包括EditText-->
<include layout="@layout/sendbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/include_send"/>
</ScrollView>
</LinearLayout>
[/quote]
你的代码不全,给你写了个案例,你运行下就知道效果了:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_scroll_view_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.apptest.activity.other.ScrollViewLayoutAct">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:hint="第一栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第二栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第三栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第四栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第五栏" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:hint="第六栏" />
</LinearLayout>
</ScrollView>
[/quote]
终于找到问题所在了,太感谢了<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBack"
tools:context="com.example.administrator.ChatActivity">
<!--这是自定义的AtionBar,这部分也会被顶出布局-->
<include layout="@layout/namebar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<!--这里是要显示的内容,我希望的效果是点击EditText后只有这部分上移-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycleview_message"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!--这个布局里包括EditText-->
<include layout="@layout/sendbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/include_send"/>
</ScrollView>
</LinearLayout>