I want to add a couple buttons to the bottom of my preferences screen for setting defaults and restoring defaults. This answer doesn\'t cover how to do this using PreferenceFrag
I modified the previous post a little bit, so that the button will get attached at the bottom of the view.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LinearLayout v = (LinearLayout) super.onCreateView(inflater, container, savedInstanceState);
Button btn = new Button(getActivity().getApplicationContext());
btn.setText("Button on Bottom");
v.addView(btn);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}
});
return v;
}