相关疑难解决方法(0)

Android当软键盘可见时,如何在全屏模式下调整布局

当软键盘处于活动状态并且我已成功实现它时,我已经研究了很多调整布局但是当我android:theme="@android:style/Theme.NoTitleBar.Fullscreen"在清单文件中的活动标签中使用它时问题就出现了.

为此,我使用android:windowSoftInputMode="adjustPan|adjustResize|stateHidden"了不同的选项,但没有运气.

之后,我以FullScreen编程方式实现并尝试了各种布局,FullScreen但都是徒劳的.

我引用了这些链接,并在此处查看了许多与此问题相关的帖子:

http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

http://davidwparker.com/2011/08/30/android-how-to-float-a-row-above-keyboard/

这是xml代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/masterContainerView"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#ffffff">

    <ScrollView android:id="@+id/parentScrollView"
        android:layout_width="fill_parent" android:layout_height="wrap_content">

        <LinearLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:orientation="vertical">

            <TextView android:id="@+id/setup_txt" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Setup - Step 1 of 3"
                android:textColor="@color/top_header_txt_color" android:textSize="20dp"
                android:padding="8dp" android:gravity="center_horizontal" />

            <TextView android:id="@+id/txt_header" android:layout_width="fill_parent"
                android:layout_height="40dp" android:text="AutoReply:"
                android:textColor="@color/top_header_txt_color" android:textSize="14dp"
                android:textStyle="bold" android:padding="10dp"
                android:layout_below="@+id/setup_txt" />

            <EditText android:id="@+id/edit_message"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:text="Some text here." android:textSize="16dp"
                android:textColor="@color/setting_editmsg_color" android:padding="10dp"
                android:minLines="5" android:maxLines="6" android:layout_below="@+id/txt_header"
                android:gravity="top" android:scrollbars="vertical"
                android:maxLength="132" />

            <ImageView android:id="@+id/image_bottom"
                android:layout_width="fill_parent" android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-layout android-softkeyboard

170
推荐指数
13
解决办法
13万
查看次数

软键盘出现时如何调整布局

我想在软键盘激活时调整/重新调整布局大小,如下所示:

之前和之后:

在此输入图像描述在此输入图像描述


在SO中找到了几个资源:

  1. 如何在显示软键盘时保持所有字段和文本可见
  2. android软键盘出现时会破坏布局
  3. 软键盘打开时调整布局

但问题和答案相当模糊,这里的问题是我想要的更清晰的画面.

要求:

  • 它应该适用于任何屏幕尺寸的手机.
  • 注意到"FACEBOOK"和"注册Facebook"的保证金/填充空间在之前和之后都发生了变化.
  • 不涉及滚动视图.

android android-layout android-softkeyboard

147
推荐指数
8
解决办法
14万
查看次数

显示键盘时,屏幕布局会向上移动

假设我有以下布局:

http://i47.tinypic.com/2vchnih.png

当我点击底部的编辑文本时,我得到了这个:

http://i45.tinypic.com/352lym9.png

您可以注意到顶部的图像向上,整个布局移动.这是我的xml这个布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="#FFFFFF" >

   <LinearLayout
       android:id="@+id/header"
       android:layout_width="fill_parent"
       android:layout_height="75dp"
       android:layout_alignParentLeft="true"
       android:layout_alignParentRight="true"
       android:layout_alignParentTop="true"        
       android:isScrollContainer="true"
       android:background="@drawable/header" >
   </LinearLayout>

   <ScrollView
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:id="@+id/scrollauthentication"
       android:layout_below="@+id/header"
       android:background="#FFFFFF"
       android:fillViewport="true" >

       <RelativeLayout
           xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:background="#FFFFFF" 
           android:id="@+id/authenticationrelativelayout">

           <TextView
               android:id="@+id/login"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_alignParentLeft="true"
               android:layout_below="@+id/header"
               android:layout_marginLeft="30dp"
               android:layout_marginTop="20dp"
               android:text="login"
               android:textAppearance="?android:attr/textAppearanceMedium"
               android:textColor="@color/lighter_orange"
               android:textSize="28dp" />

           <TextView
               android:id="@+id/usernameTextView"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_alignLeft="@+id/login"
               android:layout_below="@+id/login"
               android:layout_marginTop="16dp"
               android:text="username"
               android:textAppearance="?android:attr/textAppearanceMedium"
               android:textColor="@color/dark_gray" />

           <EditText
               android:id="@+id/user"
               android:layout_width="260dp"
               android:layout_height="42dp"
               android:layout_alignLeft="@+id/usernameTextView"
               android:layout_below="@+id/usernameTextView"
               android:background="@drawable/edittext_selector"
               android:imeOptions="actionDone"
               android:lines="1"
               android:paddingLeft="10dp" />

           <TextView
               android:id="@+id/passwordTextView"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_alignLeft="@+id/user"
               android:layout_below="@+id/user" …
Run Code Online (Sandbox Code Playgroud)

keyboard layout android

20
推荐指数
2
解决办法
4万
查看次数

ScrollView在Android中显示键盘时不工作

我的问题是键盘打开时scrollview无法正常工作.基本上当我有主题android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" scrollview不起作用当我有主题android:theme="@android:style/Theme.Black.NoTitleBar"并从清单中删除它 android:windowSoftInputMode="adjustResize"然后scrollview工作完美.但我的应用主题是android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen".

这是我的活动

package com.example.demo;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

}
Run Code Online (Sandbox Code Playgroud)

这是我的xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <Button

                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="btn1" />

            <Button

                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="btn2" />

            <Button

                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="btn3" />

            <Button

                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="btn4" />

            <Button

                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="btn5" />

            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

            <Button …
Run Code Online (Sandbox Code Playgroud)

android

4
推荐指数
2
解决办法
7422
查看次数

键盘窗口SoftInputMode片段

我有一个表格事故。

当我使用键盘时,如何滚动到底部?

通常,当我使用 Activity 时,我会放置 android:windowSoftInputMode="adjustResize".

但现在我正在使用片段,并且无法在清单中定义,搜索我发现的互联网:

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Run Code Online (Sandbox Code Playgroud)

但它不工作。

相关文章:

android 使布局在软键盘打开时可滚动,但不向上移动

软键盘弹出时页面滚动

android

2
推荐指数
1
解决办法
6553
查看次数