how to add views to linear layout?

后端 未结 3 494
梦毁少年i
梦毁少年i 2021-01-04 05:24

It is possible to add views to Linear Layout one after another in upward direction.

if any one working on that,please help me

相关标签:
3条回答
  • 2021-01-04 05:37

    If you want to add views to LinearLayout in upward direction(i.e. from bottom to up) use

    android:gravity="bottom"
    

    property in the xml of LinearLayout and then add views in the layout. Hope this will solve your problem.

    0 讨论(0)
  • 2021-01-04 05:55

    If you want to keep your views top, relativelayout is another choice.

    0 讨论(0)
  • 2021-01-04 05:58

    You can add it programmatically with:

    LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
    layout.addView(newView, index);
    

    You just have to add always with index = 0

    Is this the answer to your question?

    0 讨论(0)
提交回复
热议问题