android


automatic scrollable scrollview with textview


Why isn't my Scrollview automatic scrolling? I don't get it.. it just doesn't move...
package com.lernapp.src.Activities;
import java.io.IOException;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import com.lernapp.src.R;
import com.lernapp.src.Database.DbConfig;
import com.lernapp.src.Database.LernAppOpenHelper;
public class StartMenu extends Activity {
private ScrollView scroller;
private TextView text;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.startmenu);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Button infoButton = (Button)findViewById(R.id.startmenubutton4);
infoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
LayoutInflater inflater = (LayoutInflater)StartMenu.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final PopupWindow pw = new PopupWindow(
inflater.inflate(R.layout.infopopup, null, false),
300,
400,
false);
pw.setBackgroundDrawable(new BitmapDrawable());
pw.setOutsideTouchable(true);
pw.showAtLocation(findViewById(R.id.startmenumain), Gravity.CENTER, 0, 0);
View view = inflater.inflate(R.layout.infopopup, null, false);
scroller = (ScrollView)view.findViewById(R.id.scroller);
text = (TextView)view.findViewById(R.id.scrolltext);
scroller.post(new Runnable() {
public void run() {
scroller.smoothScrollTo(0, text.getBottom());
}
});
}
});
}
}
and popupxml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
android:id="#+id/scroller">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dip"
android:text="test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n "
android:color="#FFFFFF"
android:id="#+id/scrolltext"/>
</ScrollView>
Why not only use a TextView, it can scroll horizontally.
android:elippsize="marquee"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
I think you need to change your height to wrap_content:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:id="#+id/scroller">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n "
android:color="#FFFFFF"
android:id="#+id/scrolltext"/>
</ScrollView>

Related Links

Android Bitmap usage Optimization
Android | Google Sign | Get IdToken correctly in silent
Integrate firebase notifications topics and firebase authentication
Nesting a ScrollView inside a TableRow
AndroidStudio order mixed up when using Intents to open Activities
Prevent Joda-Time to print negative numbers
Getting email from Facebook - FB android SDK
Pick an image and save it in custom folder
Android Insistent Notification Interrupted By SMS - How to make uninterruptable?
Android: Send notifications to all users
Android: Hiding soft keyboard when touching out of EditText
Appcompact EditText give Error on click of Cursor
No design library issue
coronasdk sqlite copy database to computer from device
Upload video to google drive using android api
Android ObjectAnimator+ValueAnimator laggy

Categories

HOME
django
go
gridview
facebook-oauth
jpa
hyperlink
ns-3
powerpoint
spring-data-redis
knitr
rendering
emscripten
hpc
settings
crystal-lang
nfs
character
qpython
fabric.io
project
atlassian
libusb
powershell-v5.0
android-7.0-nougat
jersey-1.0
google-picker
digital-signature
symfony-console
cfml
microsoft-ocr
question2answer
ckfinder
tiki-wiki
siri
jasmine-node
asymptotic-complexity
bringtofront
ceylon
memory-address
catch-unit-test
github3.py
vue-chartjs
nested-lists
git-rewrite-history
release
bc
recurrent-neural-network
cin
glm-math
oracle-service-bus
android-exoplayer
xmldocument
wc
vaadin-charts
facebook-social-plugins
gitlist
convex-optimization
x-ray
video-conferencing
opengl-4
objectscript
polyline
change-tracking
actor-platform
redbeard-ios
myspace
dotnetnuke-7
neon
dup
tooleap
stream-processing
mediametadataretriever
dbamp
false-sharing
relativelayout
state-restoration
qt5.2
computer-architecture
sapscript
broadband
dbaccess
viewer
primitive-types
post-commit-hook
genymotion-call
rmysql
xml-namespaces
android-audiorecord
mbunit
unit-of-work
windows-98
mysql-error-2013
preload
asplinkbutton
pstack
subgraph
window-decoration
procedures
catransform3d
update-statement
webdev.webserver
uipagecontrol
dataform
tmx
twitterizer
photolibrary
drupal-fivestar
qtabbar
data-mapping
xslcompiledtransform
wspbuilder

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App