user123
user123

Reputation: 538

adding List view to a fragment shrinks layout

I have an android activity which has three fragments and in one of the fragments I am using list view to display a list. The list can be long and the view needs to be scroll able. When the activity starts onCreateView method of all fragments is called. This is code for onCreateView method

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
    {
        View rootView;
        rootView=inflater.inflate(R.layout.files, container,false);
        WebService.getFiles((UsersPOJO)getArguments().getSerializable("currentUser"));
        return rootView;
    }

R.layout.files has listView. The problem is when the activity starts layout of all the three fragments in that activity shrinks when a soft keypad pops up. I tried to set isScrollContainer to false on individual layout but it isn't working any solutions to this problem.

EDIT: R.layout.files

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/WhiteBackground"
    android:orientation="vertical">

    <ProgressBar
        android:id="@+id/filesLoading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_gravity="center"/>

    <TextView
        android:id="@+id/noFiles"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/edit_text_left_margin"
        android:layout_marginRight="@dimen/edit_text_right_margin"
        android:layout_marginTop="@dimen/heading_top_margin"/>

    <ListView
        android:id="@+id/filesListView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </ListView>


</LinearLayout>

Upvotes: 1

Views: 264

Answers (1)

holtaf
holtaf

Reputation: 787

Take a look at windowsSoftInputMode attribute inside your AndroidMenifest.xml file. Just set windowsSoftInputMode to adjustPanin your <activity>.

Upvotes: 1

Related Questions