好的,即时通讯已经在做(我相信),当显示软键盘时,我需要做的所有事情才能使我的应用程序布局滚动/向上移动,但是它无法正常工作,所以我猜测一定有某种即时通讯正在停止它,我想知道它是否固定的高度,这使我的观看者无法意识到,或者我已经读完了一些文章,这些文章在显示键盘时将相对布局描述为“粉碎子视图”,而线性布局则不会粉碎子视图,因此请记住,这是我的布局
主要活动
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/viewpagerHolder">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager2"
android:layout_width="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_height="@dimen/card_pager_height" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/predictsHolder"
android:layout_below="@id/viewpager2">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_predicts"
android:layout_width="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_height="@dimen/predicts_pager_height" />
</RelativeLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/predictsHolder"
app:tabGravity="fill"
android:theme="@style/CustomTabLayoutStyle" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tabs">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:background="@color/windowBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</RelativeLayout>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/card_pager_height">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
app:elevation="4dp"
android:src="@drawable/ic_playlist_play_white_24dp" …Run Code Online (Sandbox Code Playgroud) 我的问题是键盘打开时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) 我必须在全屏模式下开发一个应用程序,现在我有一个带有一些textEdits和一些按钮的公式编辑器。如果键盘弹出,它将隐藏两个按钮,因此我将所有内容都放入了滚动视图:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
tools:context="controller.RegsiterActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/register_textview_firstname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_firstname" />
<EditText
android:id="@+id/register_textedit_firstname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<TextView
android:id="@+id/register_textview_lastname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_lastname" />
<EditText
android:id="@+id/register_textedit_lastname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<TextView
android:id="@+id/register_textview_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_email" />
<EditText
android:id="@+id/register_textedit_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="textEmailAddress" />
<TextView
android:id="@+id/register_text_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_password" />
<EditText
android:id="@+id/register_textedit_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<Button
android:id="@+id/register_button_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_register" /> …Run Code Online (Sandbox Code Playgroud) 我已经成功地在几个活动中实现了AdjustResize,但是特别是一个活动仍然拒绝做任何事情,但是当显示键盘时它会平移.
我有什么想法我做错了吗?
我正在使用xamarin属性,如下所示:
[Activity (
LaunchMode=Android.Content.PM.LaunchMode.SingleTask,
Label = "Active Jobs",
MainLauncher = false,
Icon = "@drawable/icon",
WindowSoftInputMode = SoftInput.AdjustResize,
ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
Run Code Online (Sandbox Code Playgroud)
编辑:此活动的基础axml布局
<?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">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px"
android:background="#FFFFFF"
android:gravity="center|top"
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="40dp">
<TextView
android:text="No active works on this device."
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="0dp"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:visibility="gone"
android:textColor="#006985"
android:textSize="30dp" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:textColor="#006985"
android:textSize="30dp"
android:divider="@null"
android:dividerHeight="-0.6dp"
android:layout_gravity="top" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center|center"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="40dp"
android:paddingBottom="60dp" …Run Code Online (Sandbox Code Playgroud) 我有一个使用全屏运行的应用程序:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Run Code Online (Sandbox Code Playgroud)
由于这个布局,android:windowSoftInputMode="adjustResize"不能正常工作,即它没有调整大小.
有没有办法克服这个问题?
我正在以全屏模式开发一个Android应用程序。我希望在显示软输入时自动调整屏幕。我正在使用ScrollView使我的屏幕可以扩展到大于最大高度。您可以在下面看到布局XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="${packageName}.${activityClass}" >
<VideoView
android:id="@+id/taskdetail_bgvideo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
<ScrollView
android:id="@+id/taskdetail_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Other Widgets -->
</LinearLayout>
</ScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
将VideoView放置在背景中,以便在整体布局中创建背景视频。
我在Android中尝试了变通方法,当软键盘可见时如何在全屏模式下调整布局,但就我而言,它无法按预期工作。当我选择最底部的TextView时,所有屏幕都以某种方式向上推到顶部,在软键盘和活动屏幕之间留有很大的黑色区域。查看下面的屏幕截图(很抱歉,信誉仍然很低,因此无法直接发布图像:()
那么,您有什么可能的主意来解决这种奇怪的行为吗?另外,我还尝试将softInputMode设置为ADJUST_RESIZE或ADJUST_PAN,这两个设置都可以做到这一点。当我将其设置为ADJUST_NOTHING时,没有任何调整。
当我不使用上面提到的解决方法时,无法将视图滚动到最底部的窗口小部件,但是以某种方式将窗口视图平移到聚焦的TextView上。我认为这实际上是罪魁祸首,但我不知道如何解决。
提前致谢 :)
我已经设计好了
通过采取从参考布局这个和编码相同如下.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/action_bar_color"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="@+id/txt_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="@dimen/image_margin_left"
android:text="@string/app_name"
android:textColor="@android:color/black"
android:textSize="@dimen/login_txt_size" />
<ImageView
android:id="@+id/img_refresh"
android:layout_width="@dimen/logo_image_w"
android:layout_height="@dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="@dimen/image_margin_left"
android:background="@drawable/custom_image_click"
android:src="@drawable/ic_action_refresh" />
<ImageView
android:id="@+id/img_setting"
android:layout_width="@dimen/logo_image_w"
android:layout_height="@dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="@dimen/image_margin_left"
android:background="@drawable/custom_image_click"
android:src="@drawable/ic_action_settings" />
<ImageView
android:id="@+id/img_wifi"
android:layout_width="@dimen/logo_image_w"
android:layout_height="@dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="@dimen/image_margin_left"
android:background="@drawable/custom_image_click"
android:src="@drawable/ic_wifi_on"
android:tint="@color/button_theme_color" />
</android.support.v7.widget.Toolbar>
<TextView
android:id="@+id/tv_home_networkStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#003b60"
android:gravity="center_horizontal"
android:padding="10dp"
android:text="Medium Text"
android:textColor="#FFFF0000"
android:textSize="20sp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent" …Run Code Online (Sandbox Code Playgroud) 当键盘显示时,我的布局变得混乱.

这是我的android清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.BJ.Food4All"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application
android:name="CookTales"
android:icon="@drawable/application_icon"
android:label="@string/app_name" >
<activity
android:screenOrientation="portrait"
android:name=".MyFood4AllActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.Mailbox.MailboxActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity android:name=".Activities.About.AboutDialog"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity android:name=".Activities.Settings.SettingsActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity android:name="org.BJ.Food4All.Share_Facebook" />
<activity android:name=".NewRecipeActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity android:name=".Activities.RecipeBook.RecipeBookTabHostActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Light.NoFrame"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="@string/searchRecipe_title" >
</activity>
<activity android:name=".Activities.NewRecipe.Ingredients"
android:screenOrientation="portrait"
android:label="@string/ingredients_title"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" >
</activity> …Run Code Online (Sandbox Code Playgroud)