android:windowSoftInputMode=“adjustResize” ne fonctionne pas comme il devrait être
Même si ce problème a de nombreuses solutions dans stackoverflow, je ne pouvais pas résoudre mon problème.
J'ai deux éditer des textes à l'écran, l'un en haut, l'autre est attaché vers le bas de l'écran.
Chaque fois que je clique sur le fond de modifier le texte, la touche programmable conseil vient sur elle. J'ai déjà joué avec windowSoftInputMode.
Je ne veux pas que les autres le contenu de l'écran pour faire défiler jusqu'lorsque je clique sur mon bas edittext.
C'est mon xml de mise en page.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/phone_number_edit_text_compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_toLeftOf="@id/select_contact"
android:background="@drawable/phone_edittext_background_selector"
android:ems="10"
android:hint="@string/phone_edittext_hint"
android:inputType="phone"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingTop="12dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<ImageButton
android:id="@+id/selectcontact_compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/phone_number_edit_text_compose"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_toRightOf="@id/phone_number_edit_text_compose"
android:background="@drawable/select_contact_background_selector"
android:contentDescription="@string/select_contact_content_description"
android:src="@drawable/select_contact_selector"
android:layout_marginLeft="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"/>
<View
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/phone_number_edit_text_compose"
android:layout_marginTop="@dimen/redial_screen_distance_between_views"
android:background="@drawable/separator" />
<LinearLayout
android:id="@+id/repetition_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view1"
android:clickable="true"
android:onClick="RepetitionLayoutClickListener"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:background="@drawable/repetition_layout_background_selector"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/repetition_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/repetition"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="@+id/repetition_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:popupBackground="@color/dark_background" />
</LinearLayout>
<View
android:id="@+id/view2"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/repetition_layout"
android:background="@drawable/separator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view2"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:id="@+id/date_layout">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/d"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/date_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/a"
android:paddingLeft="5dp"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<View
android:id="@+id/view3"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/date_layout"
android:background="@drawable/separator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view3"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:id="@+id/time_layout">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/t"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/b"
android:paddingLeft="5dp"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/compose_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/compose_message_background"
android:hint="@string/compose_message_hint"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_toLeftOf="@+id/imageButton1" >
</EditText>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/send_button_background"
android:src="@drawable/ic_action_send_now"
android:paddingRight="8dp"
android:paddingLeft="8dp"
android:layout_alignBottom="@+id/editText1"
android:layout_alignTop="@+id/editText1"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>
Et ce mon manifeste xml.
<activity
android:name="com.task.SmsScreen"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
>
</activity>
Utilisez cette android:windowSoftInputMode="adjustPan|stateVisible"
essayez
J'ai joué avec toutes les combinaison Piyush... Ceci fait défiler tous les autres le contenu de l'écran vers le haut.
Ceci fait défiler tous les autres le contenu de l'écran vers le haut
essayez
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
J'ai joué avec toutes les combinaison Piyush... Ceci fait défiler tous les autres le contenu de l'écran vers le haut.
Ceci fait défiler tous les autres le contenu de l'écran vers le haut
OriginalL'auteur | 2014-03-13
Vous devez vous connecter pour publier un commentaire.
Supprimer votre extérieur Linéaire de la Mise en page et placez le tout à l'intérieur d'une Relative Mise en page. Et d'aligner votre fond de modifier le texte pour le bas de la mise en page en faisant alignParentBottom vrai.
Et la chose principale est de "Ne rien faire pour le android:windowSoftInputMode." Supprimer cette ligne du fichier manifeste.
Laissez android prendre par défaut.
OriginalL'auteur Praveena
Vous ne dites pas que la version d'android êtes-vous pour la compilation et la version à laquelle vous êtes en cours d'exécution sur.
Mais de vérifier si vous avez peut-être utiliser l'option plein écran fixé par sur android:windowFullscreen attribut ou par la mise en FLAG_FULSCREEN. Cela empêche adjusrResize option marche pas correctement sur les nouvelles Api. Il fonctionne pour les API 10 (2.3.5).
OriginalL'auteur Anderson
Vous devez utiliser
OriginalL'auteur user8938
Après deux jours de tracas et de la lecture de tous les stackoverflow solutions je suis venu avec mon propre. Il a travaillé pour moi.
J'ai dû utiliser le scrollview alors seulement il s'ajuste dans le petit espace par la réduction de la vue. Sans le scrollview j'ai dû utiliser la Ultrapériphériques LinearLayout avec layout_gravity:bas. Mais dans ce cas les paramètres de tous les éléments gouttes au bas de l'Écran. si utilisé layout_margintop ou layout_marginbottom puis lorsque le clavier apparaît le textview ou edittextview jeté hors de l'écran .. Grrrrrrrrrrr....
Donc, finalement, j'ai trouvé cette solution espère qu'il peut résoudre certains de vos problèmes.
dans Manifest.xml
<activity
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:configChanges="orientation">
Dans La Mise En Page:
mettre un Linearlayout balise englobante après le scrollview.
Android vraiment vraiment horrible .
Infos sur l'appareil
Devcie: Xperia Z
OS: JellyBean
[ Ne sais pas comment il va se comporter dans les anciennes versions.]
OriginalL'auteur Kazi Forhan Ahmed