6
I have a layout
simple according to the shown below that it has a ScrollView
horizontal when exceeding the limit of TextView
.
But I would like when inserting text the focus of TextView
was always at the last inserted value and did not need to scroll the bar to see the last inserted value.
Like an automatic scrolling to keep up with the entered values.
And return manually to the start bar if you need to.
Does anyone have any idea how to do ?
Activity:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textview = (TextView) findViewById(R.id.textview);
textview.setMovementMethod(new ScrollingMovementMethod());
}
}
xml:
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
<TextView
android:id="@+id/display0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
android:gravity="center|right" />
</HorizontalScrollView>
</LinearLayout>
this object "scroller" you created where ?
– Paulo
opa, is the Scrollview itself. I simplified the in the statement and forgot there.
– Dener