Как сделать видимым сфокусированный текст редактирования при появлении программной клавиатуры?

#java #android #uiview #android-manifest #android-softkeyboard

#java #Android #uiview #android-манифест #android-softkeyboard

Вопрос:

Я пытаюсь создать приложение, в котором содержимое внутри макета является плотным. Однако я хочу функциональность, которая будет продолжать показывать мой сфокусированный текст редактирования в верхней половине экрана при появлении программной клавиатуры…

Пока что мои исследования говорят, что я должен использовать…

    <activity android:windowSoftInputMode="adjustUnspecified" android:name=".main">
        <intent-filter>
            <action android:name="com.last.project.main" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
  

Мне сказали, что (это) android: windowSoftInputMode=»adjustUnspecified» строка Manifest.xml решит мою проблему, однако, похоже, это не работает.
(Мне сказали, что это означает …. по этой ссылке я прочитал http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft )

Просто нужно знать, почему это не работает…Существуют ли какие-либо другие причины, которые могут повлиять на мой XML-манифест, чтобы просто игнорировать то, что я написал?

Дайте мне знать, если потребуются какие-либо другие коды

Огромное спасибо,

Krio

Мой XML-макет…

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_height="wrap_content" 
    android:id="@ id/linearLayout1" 
    android:layout_width="match_parent">
    <ImageView android:src="@drawable/header" 
        android:layout_height="wrap_content" 
        android:id="@ id/imageView1" 
        android:layout_width="match_parent" >
    </ImageView>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content" 
    android:id="@ id/linearLayout2" 
    android:layout_width="match_parent" 
    android:baselineAligned="false" 
    android:layout_gravity="fill">
        <Button android:layout_height="wrap_content" 
            android:text="English" android:id="@ id/button1" 
            android:onClick="languageSelectionButtonFrom" 
            android:layout_width="wrap_content" 
            android:layout_weight="2">
        </Button>
        <ImageButton android:layout_height="wrap_content" 
            android:src="@drawable/arrow" 
            android:id="@ id/imageButton1" 
            android:layout_width="wrap_content">
        </ImageButton>
        <Button android:text="English" 
            android:onClick="languageSelectionButtonTo" 
            android:id="@ id/button3" 
            android:layout_gravity="right" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_weight="2">
        </Button>
</LinearLayout>
<TableLayout android:id="@ id/tableLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent">
        <EditText android:hint="Text to translate..."  
            android:layout_width="wrap_content" 
            android:id="@ id/editText1" 
            android:layout_height="wrap_content">
        </EditText>
        <Button android:text="Translate" 
            android:id="@ id/button4" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:onClick="translationButtonClickHandler" >
        </Button>
        <TextView android:text="Translation :" 
            android:textSize="15sp" 
            android:id="@ id/textView1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
        </TextView>
        <EditText android:text="" 
            android:layout_width="wrap_content" 
            android:id="@ id/editText2" 
            android:scrollbars="vertical" 
            android:layout_weight="4" 
            android:gravity="top"  
            android:layout_height="match_parent">
        </EditText>
     </TableLayout>
</LinearLayout>
  

Ответ №1:

Проблема решена Спасибо людям, которые пытались запустить brain strom…

ответ такой…Мы должны поместить все содержимое макета в режим прокрутки, чтобы заставить эту штуку работать!

Итак, в моем случае

 <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
....(All other content omitted for whole file reference same xml text inside question)
</LinearLayout>
</ScrollView>