How do you ask your header on listView not to twist?



  • Created the list, but the lines are off the screen. When I start losing my header. Skin what it looks like: введите сюда описание изображения

    Leaf marking:

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/lv__pipes_flowV"
        android:layout_gravity="center_horizontal"
        android:headerDividersEnabled="true"
        android:scrollingCache="false"/>
    

    Leaf code:

    ListView lv__pipes_flowV;
    
        // упаковываем данные в понятную для адаптера структуру
        ArrayList&lt;Map&lt;String, Object&gt;&gt; data = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(
                diameter_table.length);
        Map&lt;String, Object&gt; m;
        for (int i = 0; i &lt; diameter_table.length; i++) {
            m = new HashMap&lt;String, Object&gt;();
            m.put("column_1", diameter_table[i]);
            m.put("column_2", min_flow_table[i]);
            m.put("column_3", max_flow_table[i]);
            data.add(m);
        }
    
        // массив имен атрибутов, из которых будут читаться данные
        String[] from = { "column_1", "column_2", "column_3" };
        // массив ID View-компонентов, в которые будут вставлять данные
        int[] to = { R.id.tv_table_row_3_column_1, R.id.tv_table_row_3_column_2, R.id.tv_table_row_3_column_3 };
    
        // создаем адаптер
        SimpleAdapter sAdapter = new SimpleAdapter(getActivity(), data, R.layout.table_row_3_column, from, to);
    
        // определяем список и присваиваем ему адаптер
        lv__pipes_flowV = (ListView) rootView.findViewById(R.id.lv__pipes_flowV);
    
        LayoutInflater ltInflater = LayoutInflater.from(getActivity());
        View header = ltInflater.inflate(R.layout.table_row_3_column, null, false);
        TextView tv_table_row_3_column_1 = (TextView) header.findViewById(R.id.tv_table_row_3_column_1);
        tv_table_row_3_column_1.setText(R.string.tv_pipes_flowD_Diameter);
        TextView tv_table_row_3_column_2 = (TextView) header.findViewById(R.id.tv_table_row_3_column_2);
        tv_table_row_3_column_2.setText(R.string.gv_pipes_flowV_header_min_flow_text);
        TextView tv_table_row_3_column_3 = (TextView) header.findViewById(R.id.tv_table_row_3_column_3);
        tv_table_row_3_column_3.setText(R.string.gv_pipes_flowV_header_max_flow_text);
        lv__pipes_flowV.addHeaderView(header);
    
    
        lv__pipes_flowV.setAdapter(sAdapter);
    



  • There's no way to fix it. header ListView and not to give him a twist, as it is being implemented as another part of the list and is being clicked with the others.

    You've got to move. header as a separate marking unit, not part ListView




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2