Hello, gentlemen. On Android, a newcomer here and the first one appeared.

Immediately to the point. Actually, I have a fragment and I throw it in the main activit's layout and there is a ScroolView, so now he pushed me all my sheets in the size of one sheet. I tried everything enter image description here . Help

Xml of the main unit where I throw a fragment

<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scroll"> <LinearLayout android:id="@+id/linLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <fragment android:name="com.example.serik.astanawebmarket.fragments.ListFragm" android:layout_width="match_parent" android:layout_height="match_parent"> </fragment> </LinearLayout> </ScrollView> 


xml fragment

 <TextView android:id="@+id/tvName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="top|center_horizontal" android:textSize="24sp"> </TextView> <TextView android:id="@+id/tvSalary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="bottom|right" android:layout_marginRight="5dp"> </TextView> <TextView android:id="@+id/tvPosition" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="center_horizontal|bottom" android:layout_marginLeft="5dp"> </TextView> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_gravity="left|top" android:src="@android:drawable/alert_light_frame"/> 

I throw so

List> aList = new ArrayList> ();

  for(int i=0;i<name.length;i++){ HashMap<String, String> hm = new HashMap<String,String>(); hm.put("tvName", name[i]); hm.put("tvPosition","Должность: " + position[i]); hm.put("tvSalary", "Оклад: "+Integer.toString(salary[i]) ); aList.add(hm); } SpecialAdapter adapter = new SpecialAdapter (getActivity().getBaseContext(), aList, R.layout.fragment_item, new String[] { "tvName","tvPosition","tvSalary" }, new int[]{ R.id.tvName,R.id.tvPosition,R.id.tvSalary}); setListAdapter(adapter); return super.onCreateView(inflater, container, savedInstanceState); 

    1 answer 1

     <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scroll"> <LinearLayout android:id="@+id/linLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/tvName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="top|center_horizontal" android:textSize="24sp"> </TextView> <TextView android:id="@+id/tvSalary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="bottom|right" android:layout_marginRight="5dp"> </TextView> <TextView android:id="@+id/tvPosition" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="center_horizontal|bottom" android:layout_marginLeft="5dp"> </TextView> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_gravity="left|top" android:src="@android:drawable/alert_light_frame"/> </LinearLayout> </ScrollView> 

    In the markup, transfer the scroll fragments and remove from the "main unit"