Sunday, 1 February 2015

How to make the text of a scroll view start at the bottom and work it's way up?



I'm trying to make a texting application and I want the text to start at the bottom and work it's way up instead of vice versa. I've tried ScrollView.Focus_UP AND down and text alignment end. But it's not working. Why? Again, Sorry if this is a repost. I couldn't find anything on it, maybe I'm wording my question wrong.



<ScrollView
android:id="@+id/outputScrollView"

android:isScrollContainer="false"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<RelativeLayout android:id="@+id/relchatlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
>
<TextView
android:id="@+id/outputTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="#FFFFFF"
android:paddingTop="5dp"
android:layout_alignParentBottom="true"

/>
</RelativeLayout>
</ScrollView>


public void onSendClicked(View view){
outputScrollView.fullScroll(ScrollView.FOCUS_DOWN);
outputScrollView.setTextAlignment(ScrollView.TEXT_ALIGNMENT_TEXT_START);
theClient.sendChat(inputEditText.getText().toString());
inputEditText.setText("");

No comments:

Post a Comment