2014-01-29 1 views
0

Я пытаюсь получить поле EditText, чтобы прокручивать мою камеру. Однако теперь он изменяет размер камеры. Я был бы доволен поведением adjustPan, но я хочу, чтобы actionBar оставался на экране. Я подозреваю, что это можно сделать с помощью scrollView, но, несмотря на это, я не могу предотвратить изменение размера CameraPreview.EditText on focus scroll up без изменения размера других изображений

<RelativeLayout 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" 
tools:context=".MainActivity" > 
    <FrameLayout 
    android:id="@+id/cameraPreview" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/transparent" > 

    </FrameLayout> 

<!-- Fix for black overlay on menu --> 
<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/transparent" > 
</FrameLayout> 
<ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:isScrollContainer="true" 
     > 
     <EditText 
     android:id="@+id/inputCode" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:background="@color/White" 
     android:ems="10" 
     android:inputType="textNoSuggestions" 
     android:maxLines="1" 
     android:textColor="@color/Green" 
     android:textSize="32sp" 
     android:layout_alignParentBottom="true" > 

    </EditText> 
</ScrollView> 

deformed apple

ответ

0

Наконец решил прокрутить весь вид в том числе бар действия

0

Я искал решение в течение длительного времени, в конце концов я получил его;

Это просто,

Во-первых, использование scroll_view в качестве View, который имеет edit_text ребенка;

Во-вторых, использовать Relative_Layout (Linear_Layout бесполезно), как ребенок вашей Scroll_View

Затем, вы можете увидеть его работы Примечания: (1) Не используйте layout_align_Parent_Bottom, пользовательский layout_below вместо (2) Вы не нужно указывать window_Soft_Input_Model, по умолчанию - ОК;

вот пример

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/rootlinearlayout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 

<ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="match_parent" 
    android:layout_height="500dp" 
    android:text="@string/hello_world" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="64dp" 
      android:text="Button1" /> 

     <Button 
      android:id="@+id/button6" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button6" /> 

     <Button 
      android:id="@+id/button2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button2" /> 

     <Button 
      android:id="@+id/button3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button3" /> 

     <Button 
      android:id="@+id/button4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button4" /> 

     <EditText 
      android:id="@+id/editText1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/scrollView1" 
      android:ems="10" > 
     </EditText> 

     <Button 
      android:id="@+id/button8" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button8" /> 

     <Button 
      android:id="@+id/button9" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button9" /> 

     <Button 
      android:id="@+id/button10" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button10" /> 

     <Button 
      android:id="@+id/button5" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button5" /> 
    </LinearLayout> 
</ScrollView> 

<LinearLayout 
    android:id="@+id/captionbottomrelativelayout" 
    android:layout_width="320dp" 
    android:layout_height="44dp" 
    android:layout_below="@+id/scrollView1" 
    android:orientation="horizontal" > 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:text="Button" />`enter code here` 
</LinearLayout> 

`введите код здесь

0
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" 

добавить эту строку в проявленной активности.