
Login.xml
<?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/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_1242_2208"
android:fillViewport="true" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"/>
<TextView
android:paddingTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:text="@string/patient_name"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<TextView
android:id="@+id/patientname"
android:layout_width="241dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:text=""
android:textAlignment="center"
android:textColor="@color/white_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/emergency_name"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/patientemegencynametext"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:textColor="@color/white_text" />
<TextView
android:paddingTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/emergency_number"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/patientemegencynumbertext"
android:layout_width="135dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:hint="021 1234567"
android:inputType="phone"
android:maxLength="12"
android:textColor="@color/white_text" />
<TextView
android:paddingTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/address"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:paddingBottom="10dp"
android:textColor="@color/white_text"
android:inputType="textMultiLine"
android:maxLines="2"/>
<!--Next-->
<Button
android:id="@+id/loginbutton"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:background="@drawable/whitebuttonshape"
android:textAllCaps="false"
android:textStyle="bold"
android:text="@string/next"
android:textColor="@color/blue_text"
tools:textAllCaps="false" />
<!--Back-->
<Button
android:id="@+id/backbutton"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:background="@drawable/buttonshape"
android:textAllCaps="false"
android:text="@string/back"
android:textColor="@color/white_text"
tools:textAllCaps="false" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.4"/>
</LinearLayout>
</ScrollView>
AndroidManifest.xml用于登录活动。在这里,我添加了android:windowSoftInputMode="adjustResize",用于在打开Keypad.But时滚动,无论如何,我无法滚动该视图。
<activity
android:windowSoftInputMode="adjustResize"
android:name=".activities.LoginActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />主题
Style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/black</item><!--Changes status bar colour-->
<item name="colorAccent">@color/colorAccent</item>
</style>在这里,当我单击下面的编辑文本时,我无法滚动视图。当键盘打开时,我需要滚动完整的视图。我在这里尝试了很多解决方案,但我找不到合适的解决方案。
发布于 2017-09-15 05:15:21
使用TableLayout而不是使用线性布局和
scrollview height = match_parent
tablelayout height = wrap_content将清单更改为adjustPan|adjustResize,its将工作
发布于 2017-09-15 05:24:52
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_1242_2208"
android:fillViewport="true"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" //change match_parent to wrap_content
android:gravity="center_horizontal"
android:orientation="vertical"
</LinearLayout>
</ScrollView>//将行添加到活动标记中的菜单文件中
android:windowSoftInputMode="adjustNothing"发布于 2017-09-15 05:25:54
这段代码在我的side.Try上运行得很好。
<?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/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:scrollbars="vertical">
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="30dp"
android:text="@string/patient_name"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<TextView
android:id="@+id/patientname"
android:layout_width="241dp"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:text=""
android:textAlignment="center"
android:textColor="@color/white_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/emergency_name"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/patientemegencynametext"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:textColor="@color/white_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/emergency_number"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/patientemegencynumbertext"
android:layout_width="135dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:hint="021 1234567"
android:inputType="phone"
android:maxLength="12"
android:textColor="@color/white_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/address"
android:textColor="@color/black_text"
android:textSize="@dimen/text_size" />
<EditText
android:id="@+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:backgroundTint="@color/white"
android:inputType="textMultiLine"
android:maxLines="2"
android:paddingBottom="10dp"
android:textColor="@color/white_text" />
<!--Next-->
<!--android:background="@drawable/whitebuttonshape"-->
<Button
android:id="@+id/loginbutton"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:text="@string/next"
android:textAllCaps="false"
android:textColor="@color/blue_text"
android:textStyle="bold"
tools:textAllCaps="false" />
<!--Back-->
<!--android:background="@drawable/buttonshape"-->
<Button
android:id="@+id/backbutton"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="15dp"
android:text="@string/back"
android:textAllCaps="false"
android:textColor="@color/white_text"
android:textStyle="bold"
tools:textAllCaps="false" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.4" />
</LinearLayout>
</ScrollView>https://stackoverflow.com/questions/46231946
复制相似问题