0

I have a LinearLayout inside ScrollView, this is my outline's layout:

      <ScrollView >
        <Linear Layout>
            <Linear Layout>
            <EditText/></Linear Layout>

            <Linear Layout>
            <EditText/></Linear Layout>

            <Linear Layout>
            <EditText/></Linear Layout>
            ............................................
            ............................................
            ............................................
            ............................................
            ............................................
            ............................................ //and many Views Here
            <Linear Layout>
            <Button/></Linear Layout>
        </Linear Layout>
      </ScrollView>

When I Run my Application with empty content in EditText or Spinner, The last LinearLayout that contain Button is displayed, But when I fill EditText or add another content The last LinearLayout that contain Button it shouldn't scroll anywhere and obviously not disappear. I've following the answer in here and here with adding android:layout_weight="1" and android:layout_height:"fill_parent" in 'ScrollView` but It seems doesn't work, is there another solution for my problem? thank you.

Community
  • 1
  • 1
Menma
  • 799
  • 1
  • 9
  • 35
  • 2
    why is every EditText inside linear layout? what is the use of that linear layout if it holds only one child view? – pskink Aug 15 '14 at 07:05
  • 1
    it would really help to get the full xml, not just the structure of it. – vilpe89 Aug 15 '14 at 07:15
  • @pskink that's only my outline's layout example, the truth is my layout more complex than that – Menma Aug 15 '14 at 07:25

1 Answers1

0

It can be another method:

  1. Set button over scrollView and add it to xml : android:visibility="gone"
  2. Get last scrollView position How get
  3. When scroll to the end: button.setVisibility(View.VISIBLE)
Community
  • 1
  • 1
Mykhailo
  • 331
  • 3
  • 18