欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Java TableFixHeaders 类用法示例

最编程 2024-05-22 08:48:13
...

实例1: onCreateView

import com.inqbarna.tablefixheaders.TableFixHeaders; //导入依赖的package包/类
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.entity_table, container);
    TableFixHeaders table = (TableFixHeaders) view.findViewById(R.id.entity_table);
    NodeMatrixTableAdapter adapter = new NodeMatrixTableAdapter(selectedNode, getActivity());
    table.setAdapter(adapter);
    return view;
}
 

实例2: onResume

import com.inqbarna.tablefixheaders.TableFixHeaders; //导入依赖的package包/类
public void onResume() {
    super.onResume();

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(getDialog().getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    getDialog().getWindow().setAttributes(lp);

    TableFixHeaders table = (TableFixHeaders) getView().findViewById(R.id.entity_table);
    NodeMatrixTableAdapter adapter = (NodeMatrixTableAdapter) table.getAdapter();
    int[] selectedCoordinate = adapter.selectedCoordinate();
    table.scrollTo(selectedCoordinate[0], selectedCoordinate[1]);
}