У меня есть пара EditTexts и ImageViews камеры и видеокамеры.
1). Я хочу, чтобы камера и видеокамера находились поверх программной клавиатуры, когда она открывается, когда фокус переходит на EditTexts.
2). Кроме того, с этим макетом, когда текст, который пользователь вводит в представлении editTextUserMessage, увеличивается, представление увеличивается вниз под клавиатурой. Вместо этого я хочу, чтобы он рос так, чтобы счетчик и другой EditText могли двигаться вверх. При достижении этого я хочу, чтобы 1) произошло… то есть я хочу, чтобы imageCamera и imageVideo ImageViews располагались прямо над клавиатурой.
Я пробовал использовать разные softInputModes в действии и во фрагменте... но я не увидел никаких улучшений во всем, что я хочу.
Пока Move layout вверх, когда отображается виртуальная клавиатура, выглядит многообещающе, сохранение представлений поверх клавиатуры происходит только при изменении фокуса, поэтому этот код не может всегда удерживать изображения камеры и видеокамеры поверх клавиатуры.
Все души просто перемещают весь макет вверх, чего я не хочу. Кроме того, это не активность, а фрагмент.
Вы можете мне помочь?
Ниже приведен макет моего фрагмента:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearRootInScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingBottom="@dimen/padding_bottom">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/prefix_type"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="@+id/spinnerTypes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:dropDownWidth="wrap_content"
android:padding="8dp" />
</LinearLayout>
<com.test.shield.views.SearchFriendCompletionView
android:id="@+id/editTextAddFriend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/underline_edittext"
android:gravity="left|center"
android:hint="@string/hint_add_friend"
android:imeOptions="actionDone"
android:minHeight="58dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:scrollbars="vertical"
android:textColorHint="@color/LIGHT_BLACK" />
<EditText
android:id="@+id/editTextUserMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/underline_edittext"
android:gravity="left"
android:hint="@string/hint_message"
android:inputType="textCapSentences|textMultiLine"
android:isScrollContainer="true"
android:maxLength="140"
android:minHeight="120dp"
android:padding="5dp"
android:scrollbars="vertical"
android:textColorHint="@color/LIGHT_BLACK" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearCamAndVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageCamera"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackground"
android:padding="10dp"
android:scaleType="center"
android:src="@drawable/ic_photo_camera_black_24dp" />
<ImageView
android:id="@+id/imageVideo"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/selectableItemBackground"
android:padding="10dp"
android:scaleType="center"
android:src="@drawable/ic_videocam_black_24dp" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="start"
android:orientation="vertical">
<TextView
android:id="@+id/textTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/imageMap"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="7dp"
android:paddingBottom="5dp"
android:scaleType="centerCrop" />
</LinearLayout>
</ScrollView>