开发者

How to make an activity appears in half screen in android

I have an activity where it has three EditText. When I insert data in them the soft keyboard displayed and hide the rest EditTexts so i can not see what I am writin开发者_JAVA技巧g.

What I want is to make the activity a ListActivity so I can scroll to see the EditText but i had to reduce the space that the activity take place.

What I mean is how can I make an activity to take the half screen space?!


Check how you are doing your layout, because the system automatically scrolls your Activity when you click on an EditText in order that the soft keyboard doesn't hides the field.


The best way to cope with the soft keyboard covering edit boxes is just to use a LinearLayout inside a ScrollView. Example...

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <LinearLayout 
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">

    <!-- Put your EditText widgets here -->

  </LinearLayout>
</ScrollView>


There is no need to use scrollView.

Check your manifest what value you have given for following attribute:

 android:windowSoftInputMode="adjustPan"

You should give it a try with adjustpan or adjustResize


Just hit the Back button and the soft keyboard hides

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜