Привет всем! Вобщем, есть 3 Layout. Две из них не прокручиваются (1, 3) одна должна прокручиваться.
------------
Layout 1
------------
Layout 2, должен прокручиваться в самый конец
------------
Layout 3
------------
И как сделать чтобы Layout 2 прокручивался в самый конец? Вобщем, возможно я тут накрутил, но вот как я хотел сделать:
Java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| LinearLayout ddLayoutTop = new LinearLayout(this);
ddLayoutTop.setOrientation(LinearLayout.VERTICAL);
ddLayoutTop.setGravity(Gravity.LEFT);
ddLayoutTop.setLayoutParams(dd_fill_parent);
ddLayoutTop.setBackground(new ColorDrawable(0xFF1976D2));
final LinearLayout ddLayoutBody = new LinearLayout(this);
ddLayoutBody.setOrientation(LinearLayout.VERTICAL);
ddLayoutBody.setGravity(Gravity.CENTER_HORIZONTAL);
ddLayoutBody.setLayoutParams(dd_fill_parent);
ddLayoutBody.setBackground(new ColorDrawable(0xFFEEEEEE));
final LinearLayout ddLayoutScroll = new LinearLayout(this);
ddLayoutScroll.setOrientation(LinearLayout.VERTICAL);
ddLayoutScroll.setGravity(Gravity.CENTER_HORIZONTAL);
ddLayoutScroll.setLayoutParams(dd_fill_parent);
ddLayoutScroll.setBackground(new ColorDrawable(0xFFEEEEEE));
ScrollView ddScroll = new ScrollView(this);
ddScroll.setBackgroundColor(android.R.color.transparent);
ddScroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
setContentView(ddLayoutTop);
// Elements
TextView ddTitle = new TextView(this);
ddTitle.setLayoutParams(dd_wrap_content);
ddTitle.setText(" Telescope");
ddTitle.setTextColor(0xFFffffff);
ddTitle.setTextSize(30);
TextView ddMessagesList = new TextView(this);
ddMessagesList.setLayoutParams(dd_wrap_content);
ddMessagesList.setText(" Telescope");
ddMessagesList.setTextColor(0xFFffffff);
ddMessagesList.setBackground(new ColorDrawable(0xFF263238));
ddMessagesList.setTextSize(20);
EditText ddMessage = new EditText(MSActivity.this);
ddMessage.setLayoutParams(dd_wrap_content_fill);
// Adds
ddLayoutTop.addView(ddTitle);
ddLayoutTop.addView(ddScroll);
ddScroll.addView(ddLayoutScroll);
ddLayoutScroll.addView(ddMessagesList);
ddLayoutTop.addView(ddLayoutBody); |
|
Помогите пожалуйста)
Добавлено через 13 минут
Теперь 2 элемента как надо, 1 не появляется на экран. А как сделать прокрутку в конец?
Java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| LinearLayout ddLayoutTop = new LinearLayout(this);
ddLayoutTop.setOrientation(LinearLayout.VERTICAL);
ddLayoutTop.setGravity(Gravity.LEFT);
ddLayoutTop.setLayoutParams(dd_fill_parent);
ddLayoutTop.setBackground(new ColorDrawable(0xFF1976D2));
final LinearLayout ddLayoutBody = new LinearLayout(this);
ddLayoutBody.setOrientation(LinearLayout.VERTICAL);
ddLayoutBody.setGravity(Gravity.CENTER_HORIZONTAL);
ddLayoutBody.setLayoutParams(dd_fill_parent);
ddLayoutBody.setBackground(new ColorDrawable(0xFFEEEEEE));
final LinearLayout ddLayoutScroll = new LinearLayout(this);
ddLayoutScroll.setOrientation(LinearLayout.VERTICAL);
ddLayoutScroll.setGravity(Gravity.CENTER_HORIZONTAL);
ddLayoutScroll.setLayoutParams(dd_wrap_content_fill);
ddLayoutScroll.setBackground(new ColorDrawable(0xFFEEEEEE));
ScrollView ddScroll = new ScrollView(this);
ddScroll.setBackgroundColor(android.R.color.transparent);
ddScroll.setLayoutParams(dd_wrap_content_fill);
setContentView(ddLayoutTop);
// Elements
TextView ddTitle = new TextView(this);
ddTitle.setLayoutParams(dd_wrap_content);
ddTitle.setText(" Telescope");
ddTitle.setTextColor(0xFFffffff);
ddTitle.setTextSize(30);
TextView ddMessagesList = new TextView(this);
ddMessagesList.setLayoutParams(dd_wrap_content);
ddMessagesList.setText(" Telescope");
ddMessagesList.setTextColor(0xFFffffff);
ddMessagesList.setBackground(new ColorDrawable(0xFF263238));
ddMessagesList.setTextSize(20);
EditText ddMessage = new EditText(MSActivity.this);
ddMessage.setLayoutParams(dd_wrap_content_fill);
// Adds
ddLayoutTop.addView(ddTitle);
ddLayoutTop.addView(ddScroll);
ddScroll.addView(ddLayoutScroll);
ddLayoutScroll.addView(ddMessagesList);
ddLayoutTop.addView(ddLayoutBody);
ddLayoutBody.addView(ddMessage); |
|
Добавлено через 32 минуты
Java |
1
2
3
4
| ScrollView ddScroll = new ScrollView(this);
ddScroll.setBackgroundColor(android.R.color.transparent);
ddScroll.setLayoutParams(dd_fill_parent);
ddScroll.scrollTo(0, ddScroll.getBottom()); |
|
Помогите! Не прокручивает!