I need something like this:
LinearLayout (fix)
- Button
LinearLayout
- ScrollView
- TextView
- TextView
- TextView
I want the first LinearLayout to be fix (like a header). When someone tries to scroll down, i want the TextView to go behind the fix LinearLayout. I want that button always to be visible. With this code, everything is scrolling down. Here is my code:
ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
final LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(linearLayout.VERTICAL);
scrollView.addView(linearLayout);
final LinearLayout topLinearLayout = new LinearLayout(this);
topLinearLayout.setOrientation(topLinearLayout.VERTICAL);
linearLayout.addView(topLinearLayout);
final Button button = new Button(this);
button.setText(R.string.button);
topLinearLayout.addView(button);
TextView title = new TextView(this);
title.setText(R.string.title);
title.setGravity(Gravity.CENTER);
linearLayout.addView(title);