软键盘弹出后滚动到某个点,而不是之前

时间:2017-04-06 04:00:39

标签: android scrollview android-softkeyboard

好吧基本上我希望我的ScrollView能够自动滚动到EditText的底部(在我的例子中,我为了显示目的而使得最小高度更大)。但是经过一些搜索和大量的实验之后,我能够做的就是首先滚动布局,然后键盘弹出并覆盖其余的布局,这里有一些屏幕截图:

This is what it does

This is what I want it to do

感谢您的帮助。

Xml代码:

tMap

2 个答案:

答案 0 :(得分:1)

在与活动相对应的android清单文件中尝试此操作。

# app/models/user.rb
has_many :conference_attendees, dependent: :destroy
has_many :conference_organizers, dependent: :destroy
has_many :attending, through: :conference_attendees, source: :conference
has_many :organizing, through: :conference_organizers, source: :conference

# app/models/conference.rb
has_many :conference_attendees, dependent: :destroy
has_many :conference_organizers, dependent: :destroy
has_many :attendees, through: :conference_attendees, source: :user
has_many :organizers, through: :conference_organizers, source: :user

# app/models/conference_attendee.rb
belongs_to :user
belongs_to :conference

# app/models/conference_organizer.rb
belongs_to :user
belongs_to :conference

答案 1 :(得分:0)

在您的java代码文件中,您可以输入此代码。

scrollView.requestChildFocus(newResName, newResName); // newResName is your EditText.

因此,scrollView将自动聚焦到EditText(您的newResName)。如果你不专注于EditText,你可以将焦点保持在EditText下面的RelativeLayout。这对你有用。