I'm using NavigationDrawer and some fragments. I maked a simple example with an AutoCompleteTextView, but the width don't stretch with the screen size.
Code of fragment.java:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_bestplaces, container, false);
return rootView;
}
Code of fragment.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<AutoCompleteTextView
android:id="@+id/autocomplete_find"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:hint="Search"
android:singleLine="true" />
<Button
android:id="@+id/button_find"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Find" />
</LinearLayout>
</ScrollView>
In design it's ok, but when i run the app it's wrong:
Someone can help me?