I tried pretty much every possible setting but I could not make it
work. So here is my code, maybe you can see the error? No matter what
I do the scrollbar remains "default"...
I would like to make the scrollbar with a thumb for fast scrolling
because I have a huge list to display and it would take too long to
scroll through it "normally".

The Layout-XML:
[code]<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:fastScrollEnabled="true"
    android:padding="3dip" >

        <LinearLayout
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="40dip" >

                <TextView
                        android:id="@+id/toptext"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:paddingLeft="5dip"
                        android:singleLine="true"
                        android:textColor="#FFFFFF"
                        android:textSize="16sp" />

                <TextView
                        android:id="@+id/cheatcounttext"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="90"
                        android:layout_gravity="left"
                        android:paddingLeft="5dip"
                        android:singleLine="true"
                        android:textColor="#AAAAAA"
                        android:textSize="12sp" />
        </LinearLayout>

</LinearLayout>[/code]


and the java class:
[code]package com.cheatdatabase.android;

import java.util.ArrayList;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.cheatdatabase.android.pojo.Game;
import com.cheatdatabase.android.tools.GetDataFromWeb;

/**
 * Anzeige einer Liste mit Games, welche durch die Suche gefunden
wurden.
 * http://developer.android.com/guide/tutorials/views/hello-listview.html
 *
 * @author erbsland
 *
 */
public class GameListBySystemId extends ListActivity {

        private String systemName;
        private int systemId;
        private Game[] gameMatches;
        private Intent gameListIntent;

        private ProgressDialog m_ProgressDialog = null;
        private ArrayList<Game> m_orders = null;
        private OrderAdapter m_adapter;
        private Runnable viewOrders;

        private ConnectivityManager connManager;

        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                // Internet-Verbindungs Check
                connManager = (ConnectivityManager)
getSystemService(CheatDatabaseAndroid.CONNECTIVITY_SERVICE);

                gameListIntent = getIntent();
                systemId = gameListIntent.getIntExtra("systemId", -1);
                systemName = gameListIntent.getStringExtra("systemName");

                // Fenstertitel setzen
                setTitle(systemName);

                // Testing
                Toast.makeText(this, ConnectivityManager.EXTRA_NO_CONNECTIVITY,
Toast.LENGTH_SHORT).show();

                if
((connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()
== true) ||
(connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()
== true)) {
                        m_orders = new ArrayList<Game>();
                        this.m_adapter = new OrderAdapter(this,
R.layout.gamelistbysystemidlayout, m_orders);
                        setListAdapter(this.m_adapter);

                        // "Loading" PopUp Information
                        viewOrders = new Runnable() {
                                public void run() {
                                        getGames();
                                }
                        };
                        Thread thread = new Thread(null, viewOrders, 
"MagentoBackground");
                        thread.start();
                        m_ProgressDialog = 
ProgressDialog.show(GameListBySystemId.this,
getString(R.string.please_wait) + "...",
getString(R.string.retrieving_data) + "...", true);
                } else {
                        Toast.makeText(this, R.string.no_internet,
Toast.LENGTH_SHORT).show();
                }
        }

        private void getGames() {
                gameMatches = GetDataFromWeb.getGameListBySystemId(systemId);

                m_orders = new ArrayList<Game>();

                if (gameMatches.length > 0) {
                        for (int j = 0; j < gameMatches.length; j++) {
                                m_orders.add(gameMatches[j]);
                        }
                }

                runOnUiThread(returnRes);
        }

        private Runnable returnRes = new Runnable() {

                public void run() {
                        if (m_orders != null && m_orders.size() > 0) {
                                m_adapter.notifyDataSetChanged();
                                for (int i = 0; i < m_orders.size(); i++)
                                        m_adapter.add(m_orders.get(i));
                        }
                        m_ProgressDialog.dismiss();
                        m_adapter.notifyDataSetChanged();
                }
        };

        protected void onListItemClick(ListView l, View v, int position, long
id) {
                super.onListItemClick(l, v, position, id);
                // Prüfen, ob Internetverbindung besteht.
                if
((connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()
== true) ||
(connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()
== true)) {
                        Log.v("Done", "Item clicked is " + position);

                        // Ausgewählte Informationen holen.
                        Intent explicitIntent = new 
Intent(GameListBySystemId.this,
CheatTitleList.class);
                        explicitIntent.putExtra("gameId",
gameMatches[position].getGameId());
                        explicitIntent.putExtra("gameName",
gameMatches[position].getGameName());
                        explicitIntent.putExtra("systemName", systemName);
                        explicitIntent.putExtra("systemId", systemId);

                        startActivity(explicitIntent);
                } else {
                        Toast.makeText(this, R.string.no_internet,
Toast.LENGTH_SHORT).show();
                }
        }

        private class OrderAdapter extends ArrayAdapter<Game> {

                private ArrayList<Game> items;

                public OrderAdapter(Context context, int textViewResourceId,
ArrayList<Game> items) {
                        super(context, textViewResourceId, items);
                        this.items = items;
                }

                public View getView(int position, View convertView, ViewGroup
parent) {
                        View v = convertView;
                        if (v == null) {
                                LayoutInflater vi = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                                v = 
vi.inflate(R.layout.gamelistbysystemidlayout, null);
                        }
                        Game o = items.get(position);
                        if (o != null) {
                                TextView tt = (TextView) 
v.findViewById(R.id.toptext);
                                TextView bt = (TextView) 
v.findViewById(R.id.cheatcounttext);
                                if (tt != null) {
                                        tt.setText(o.getGameName());
                                }
                                if (bt != null) {
                                        if (o.getAnzahlCheats() == 1) {
                                                bt.setText(o.getAnzahlCheats() 
+ " Cheat");
                                        } else {
                                                bt.setText(o.getAnzahlCheats() 
+ " Cheats");
                                        }
                                }
                        }
                        return v;
                }
        }
}
[/code]


thanks for any help!

-- 
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