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

How to display a different value on top of bar
Sending Sms in Android on reaching a Location
Adding context menu to a preferenceScreen child
When using GSON, do I have to keep the same POJO at REST-WS consumer & provider end for serialization & deserialization?
How to play a video in a VideoView that is stored in FirebaseStorage?
Firebase Messaging / Database
jquery mobile - touchstart does not work on Chrome & Safari IOS?
Android Studio , Assigning a Navigation Drawer activity to my current activity
Modify Firebase Realtime Database Rules from Android
Firebase Databaseui give Blank Result in Android
Ionic2 : Add platform doesn't work
2 dependent retrofit requests made by RxJava
SharedPreference to checking Actionbar status
Delphi/android how to find the involved line of code by it's address
AdMob ads not displaying in Xamarin Android application
Error in opening actvity from fragment through ListView using switch case

Categories

HOME
sonarqube
url-redirection
fabricjs
turing-machines
c++11
composite-primary-key
sublimetext
google-apps
emscripten
visual-studio-emulator
hugo
google-admin-sdk
vert.x
nstableheaderview
flume
rcloud
project
little-proxy
dkim
mod-security
xcodebuild
shared-libraries
intershop
mapstruct
boost-icl
apache2.4
asciidoctor-pdf
poedit
springfox
ember-cli
xunit
custom-post-type
realm-mobile-platform
complex-numbers
dumpbin
jett
hreflang
android-gridview
browser-extension
hivemq
connection-pool
protein-database
typesafe-config
subclipse
print-css
claims
logback-groovy
http-request
signal-strength
rfc3339
servermanager
flask-restful
linter
automapper-5
datamaps
openblas
headless
pybrain
bootstrap-tags-input
structuremap4
branch-prediction
docpad
dotnetnuke-7
firebase-security
observablecollection
freepbx
kango-framework
data-protection
database-relations
rasterize
themoviedb-api
roadkill-wiki
poppler
text-search
canalyzer
jdk1.7
airbrake
google-refine
umlgraph
java-security
rapidsvn
jbake
iiop
formview
renderer
square-bracket
clickbank
accesscontrolexception
rfc5322
mt4j
epiceditor
jquery-blockui
boost-msm
zope.interface
os.system
inkcanvas
apache-commons-dbutils
relative
umra
event-receiver
cac
tabpanel
strtod
interop-domino
perl5.12

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App