Use android:fillViewport="true" in your xml file.

On Fri, Jan 6, 2012 at 12:57 PM, Ratheesh Valamchuzhy
<android...@gmail.com>wrote:

> i  created a scroll view in xml.. i set the height of the scroll view as
> wrap content  ...and i add one linear layout to this scroll
> view programmaticaly
> what is my issue is when we add more content to the linear layout  i want
> to focus the last element in the scroll view ?
> how it is possible...
>
>
> here is my code
>
>
>           sv1=   (ScrollView) findViewById(R.id.scrollView1);
>
>    LinearLayout linearLayout =
> (LinearLayout)findViewById(R.id.LinearLayout01);
>    LinearLayout linearLayout1=new  LinearLayout(this);
>
>    // linearLayout.setGravity(gravity)
>    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
>    LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
>    chat_content =new TextView(this);chat_content.setText(msg);
>    chat_content.setTextColor(getResources().getColor(R.color.black));
>    chat_content.setGravity(Gravity.LEFT);
>    linearLayout1.setGravity(Gravity.LEFT);
>    params.setMargins(1, 5, 1, 5);
>    linearLayout1.setLayoutParams(params);
>    chat_content.setBackgroundDrawable(chatleft); chat_content.setPadding(10,1,
> 10, 1);
>    chat_content.setGravity(android.view.Gravity.CENTER_VERTICAL);
> TextView tv1 =new TextView(this);
>    chat_content.setLayoutParams(new LinearLayout.LayoutParams(180,
> LayoutParams.WRAP_CONTENT));
>
>    linearLayout1.addView(chat_content);linearLayout1.addView(tv1);
>    linearLayout.addView(linearLayout1) ;
>    sv1 .fullScroll(View.FOCUS_DOWN);
>
>
> after running this code
>
> i cant see the last element in the scroll view...i want to fucus the last
> elemnt in the scrolviw....help me
>
>
> --
> --
> ωιтн яєgαя∂ѕ
> Ratheesh * *...........
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Thank & Regards
Peeyush Varshney

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to