2016-02-07 2 views
4

У меня есть изображение из ScrollView и несколько редактируют текст в одном представлении прокрутки, но при нажатии на один EditText и открывается размер клавиатуры для этого изображения. Я не хочу менять размер этого изображения Я добавляю android:windowSoftInputMode="adjustResize|adjustPan|stateVisible" к своей деятельности в манифесты, но теперь последний EditText скрывается за клавиатурой, когда клавиатура открыта, а прокрутка не прокручивается до последней. XML: `Почему edittext скрывает скрытую программную клавиатуру

<include 
    android:id="@+id/toolbar" 
    layout="@layout/toolbar_without_elevation" /> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.25" 
    android:background="@color/primary_color" 
    android:gravity="center" 
    android:orientation="horizontal"> 

    <TextView 
     android:layout_width="@dimen/size_0_dp" 
     android:layout_height="match_parent" 
     android:layout_weight="0.3" /> 

    <com.balysv.materialripple.MaterialRippleLayout 
     android:id="@+id/rippleChangeProfileImage" 
     style="@style/ImageViewRipple" 
     android:layout_width="@dimen/size_0_dp" 
     android:layout_height="match_parent" 
     android:layout_weight="0.4" 
     android:gravity="center"> 

     <de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/imgProfile" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:layout_gravity="center" 
      android:layout_margin="@dimen/size_8_dp" 
      android:background="@drawable/ic_add_a_photo_white_48dp" 
      android:onClick="changeContactPhoto" 
      app:civ_border_color="#ffffff" 
      app:civ_border_width="2dp" /> 
    </com.balysv.materialripple.MaterialRippleLayout> 

    <TextView 
     android:layout_width="@dimen/size_0_dp" 
     android:layout_height="match_parent" 
     android:layout_weight="0.3" /> 
</LinearLayout> 

<ScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.75" 
    android:fillViewport="true" 
    android:isScrollContainer="false" 
    > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
     <!--android:layout_weight="1"--> 


     <LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/size_10_dp" 
      android:gravity="center" 
      android:orientation="vertical"> 
      <!--android:layout_marginTop="@dimen/size_10_dp"--> 

      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/linearName" 
       style="@style/ProfileLinearLayout" 
       android:layout_marginBottom="@dimen/size_5_dp"> 

       <com.rengwuxian.materialedittext.MaterialEditText 
        android:id="@+id/edtName" 
        style="@style/profileDialogEditText" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="@dimen/size_16_dp" 
        android:layout_marginRight="@dimen/size_16_dp" 
        android:layout_weight="1" 
        android:gravity="right" 
        android:paddingRight="@dimen/size_10_dp" 
        android:singleLine="true" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:textColor="@color/Profile_text_color" 
        android:textSize="@dimen/size_12_sp" 
        app:met_floatingLabel="normal" 
        android:windowSoftInputMode="adjustResize" /> 

       <ImageView 
        android:id="@+id/imgName" 
        android:layout_width="32dp" 
        android:layout_height="32dp" 
        android:layout_marginRight="16dp" 
        android:layout_marginTop="@dimen/size_15_dp" 
        android:src="@drawable/ic_person_outline_white_24dp" /> 
      </LinearLayout> 

      <ImageView 
       android:id="@+id/imageView13" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="@dimen/size_5_dp" 
       android:src="@drawable/item_separator_as_line" /> 

    //several EditText Like This 

     </LinearLayout> 

`

+0

Отправьте свой код здесь. – Stanojkovic

+0

Какова ваша AppTheme в вашем манифесте API? – Stanojkovic

+0

Theme.AppCompat.Light.NoActionBar –

ответ

2

попытаться удалить свой вес из линейного макета мастера, он должен работать; и установите ширину или высоту экрана на линейную линию.

+1

wooow это работа для меня thx a лот <3 –

+1

ваш приветственный друг;) – ShahinFasihi

0

Добавьте это в <activity>:

android:windowSoftInputMode="adjustPan" 

или:

android:windowSoftInputMode="adjustResize" 

Как это:

<activity 
    android:name="com.my.MainActivity" 
    android:screenOrientation="portrait" 
    android:label="@string/title_activity_main" 
    android:windowSoftInputMode="stateVisible|adjustResize" > 
</activity> 
+0

thx для ответа, но я добавляю его ко всем edittextes и удаляю андроид: windowSoftInputMode из манифестаций теперь прокручивается все страницы, я не хочу, чтобы изображение, которое вне прокрутки scrolview, прокручивалось –

+0

Я пришел в эту статью http: // android-developers .blogspot.rs/2009/04/update-applications-for-on-screen.html – Stanojkovic

+0

с вашим ответом при изменении экранной клавиатуры. Размер изображения менялся. Я хочу, чтобы размер изображения был const. –

Смежные вопросы