0

привет, у меня есть xml, в котором у меня есть 2 edittext и listview, когда я нажимаю на клавиатуру edittext, но edittext скроет, что я хочу подтолкнуть их, когда keyborad apprears я попробовал все решение, но не одна работа в моем случае я не сделал adjustpan и adjustresize оба, но не могу достичь моей задачей ниже моего XMLКак нажимать edittext up, когда появляется клавиатура

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

    <ToggleButton 
     android:id="@+id/onoff_switch" 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="10dp" 
     android:layout_marginTop="15dp" /> 

    <ImageView 
     android:id="@+id/qrcode_img" 
     android:layout_width="150dp" 
     android:layout_height="200dp" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="24dp" 
     android:src="@drawable/ab_bottom_solid_tabsstyle" 
     android:visibility="invisible" 
     /> 

    <TextView 
     android:id="@+id/txtscannerstatus" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBottom="@+id/qrcode_img" 
     android:layout_alignParentLeft="true" 
     android:layout_marginBottom="21dp" 
     android:layout_marginLeft="16dp" 
     android:text="Scanner Status:" 
     android:textSize="20sp" /> 

    <EditText 
     android:id="@+id/etxtrunner" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/txtrunner" 
     android:layout_alignBottom="@+id/txtrunner" 
     android:layout_alignRight="@+id/qrcode_img" 
     android:layout_alignParentRight="true" 
     android:background="@drawable/editbox_roundedcorner" 
     android:ems="10" 
     android:layout_margin="8dp" 
     android:imeOptions="actionNext" 
     android:singleLine="true" 
     android:minHeight="30dp" /> 

    <EditText 
     android:id="@+id/etxtposition" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/txtposition" 
     android:layout_alignBottom="@+id/txtposition" 
     android:layout_alignLeft="@+id/etxtrunner" 
     android:background="@drawable/editbox_roundedcorner" 
     android:ems="10" 
     android:imeOptions="actionDone" 
     android:inputType="number" 
     android:singleLine="true" 
     android:minHeight="30dp" > 
    </EditText> 

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="110dp" 
     android:layout_height="178dp" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="7dp" 
     android:layout_alignLeft="@+id/qrcode_img" 
     android:layout_alignTop="@+id/onoff_switch" > 

     <FrameLayout 
      android:id="@+id/qrcameraPreview" 
      android:layout_width="110dp" 
      android:layout_height="178dp" 
      android:adjustViewBounds="true" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="7dp" 
      android:background="@drawable/corner_shapr" /> 

     <TextView 
      android:id="@+id/campre_relative" 
      android:layout_width="110dp" 
      android:layout_height="178dp" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:layout_alignParentRight="true" 
     android:layout_marginRight="7dp" 
      android:background="@drawable/corner_shape_textview" 
      android:gravity="center" 
      android:text="Switch ON to Scan QR Code" 
      android:textColor="#adadad" 
      android:textSize="18sp" /> 
    </RelativeLayout> 



    <TextView 
     android:id="@+id/txtscanningresultfound" 
     style="@style/keyboard_textview_style" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/txtprevscannedresults" 
     android:layout_below="@+id/txtprevscannedresults" 
     android:text="No runner found" 
     android:textColor="#000000" 
     android:visibility="gone" /> 

<RelativeLayout 
    android:id="@+id/list_rl" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/txtprevscannedresults" 
    android:layout_above="@+id/adview_layout" > 

    <ListView 
     android:id="@+id/scanning_listView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 
    </ListView> 
</RelativeLayout> 


    <TextView 
     android:id="@+id/txtstatuswindow" 
     android:layout_width="300dp" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/relativeLayout1" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="16dp" 
     android:background="@drawable/corner_shape_textview" 
     android:gravity="center" 
     android:text="Enter Runner" 
     android:textColor="#00b200" 
     android:textSize="25sp" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/txtrunner" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/txtscannerstatus" 
     android:layout_below="@+id/txtstatuswindow" 
     android:layout_marginTop="16dp" 
     android:text="Runner:" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/txtposition" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/txtrunner" 
     android:layout_below="@+id/txtrunner" 
     android:layout_marginTop="14dp" 
     android:text="Position:" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/txtprevscannedresults" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/txtposition" 
     android:layout_below="@+id/txtposition" 
     android:text="Previous Scanned Results:" 
     android:layout_marginTop="5dp" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/txtqrcode" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/txtscannerstatus" 
     android:layout_marginBottom="36dp" 
     android:layout_toLeftOf="@+id/etxtposition" 
     android:visibility="invisible"/> 
<LinearLayout 
     android:id="@+id/adview_layout" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:orientation="horizontal" /> 
</RelativeLayout> 
+0

я сделал это, но та же проблема –

ответ

2

попробовать это

<activity 
     android:name="com.ex.YourActivity" 
     android:label="@string/app_name" 
     android:windowSoftInputMode="adjustPan" > 
    </activity> 
+0

я сделал adjustpan и отрегулировать размер как ее не работает –

+0

показать свой манифест ... –

+0

<активность Android: имя = «com.example.Screen» андроид: screenOrientation = "портрет" android: windowSoftInputMode = "adjustPan"> –

0

Что вы можете сделать, это в вашей деятельности в Android манифеста

<activity 
     android:name=".MainActivity" 
     android:screenOrientation="portrait" 
     android:label="@string/title_activity_main" 
     android:windowSoftInputMode="adjustResize|stateHidden|adjustPan"" > <!--add this--> 
    </activity> 

или

<LinearLayout android:id="@+id/yourlayout" > 
    <!-- Here add a header or whatever will not be scrolled. --> 
</LinearLayout> 
<ScrollView android:id="@+id/something" > 
    <!-- Here add your edittexts or whatever will scroll. --> 
</ScrollView> 

Но предпочитаю первый подход ....

+0

это решение не работает –

0

Ну я столкнулся с той же проблемой. Я также попробовал настройку и регулировку (как индивидуально, так и вместе). После моих попыток я обнаружил, что настройка (только) работает хорошо для устройств, отличных от устройств samsung.

@ Ахсан Малик, на каком устройстве вы тестируете?

+0

на Google nexus 5 –

+0

, если вы используете inputmethodmanager или вызываете клавиатуру из любого типа getwindow в классе и т. Д. Remove их всех, и пусть андроид использует поведение по умолчанию. –

+0

Хорошо настраивается на мою связь. Работает ли ваше решение на устройствах samsung? – HBB20

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