小编hon*_*eal的帖子

adjustPan不会阻止键盘覆盖EditText

我正在尝试创建一个非常基本的聊天屏幕,其中ListView显示文本,底部是EditText,EditText右侧是"发送"按钮.一切都很实用,但当我点击EditText时,虚拟键盘会覆盖它.屏幕平移一点但不足以在键盘上方可见.我的清单中有"adjustPan"标签,并且还尝试了"adjustResize"标签无效.我猜这与我的布局设置方式有关,但老实说我没有任何线索.请帮忙!

当前布局......

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ListView android:id="@+id/android:list" 
    android:layout_height="0dip" 
    android:layout_width="fill_parent"
    android:layout_weight="1"
    android:stackFromBottom="true">
</ListView>

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

    <EditText android:id="@+id/sendMessageBox"
        android:focusable="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:scrollbars="vertical"
        android:maxLines="4"
        android:text=""
        android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
        android:maxLength="1000"
        android:hint="Type your message..."
        android:imeOptions="actionSend"/>

    <Button android:id="@+id/sendMessageButton" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="Send"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-manifest android-layout android-softkeyboard

44
推荐指数
3
解决办法
5万
查看次数

如何从屏幕上删除Android偏好设置

我正在尝试从屏幕中删除首选项,以便在用户使用大于2.2的SDK时不可见.我发现有几个答案说getPreferenceScreen().removePreference(thePreference)会起作用,但每次尝试都会返回FALSE.我在错误的地方使用它吗?我代码中的任何线索?

public class Preferences extends PreferenceActivity implements OnSharedPreferenceChangeListener {

private static final String POLLING_PREFERENCE = "update_frequency_list";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);

    // Get a reference to the preferences
    mPollPref = getPreferenceScreen().findPreference(POLLING_PREFERENCE);

    //If the SDK is 2.2 or greater do not display polling preferences (using C2DM instead)
    if(Build.VERSION.SDK_INT > 7) {
        getPreferenceScreen().removePreference(mPollPref);
    }
}
....
}
Run Code Online (Sandbox Code Playgroud)

android android-preferences

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