Scrolling a dynamically filled AbsoluteLayout.

by rocrail » Fri, 23 Apr 2010 08:03:42 GMT


Sponsored Links
 Hi,

I'm searching for a few days now but I cannot find a scrolling
solution for the following layout:

<ScrollView xmlns:android=" http://schemas.android.com/apk/res/ 
android"
  android:id="@+id/levelScrollView"
  android:background="@drawable/solid_white"
  android:layout_width="fill_parent"
android:layout_height="fill_parent" >
  <LinearLayout android:layout_width="1024px"
android:layout_height="1024px">
  <AbsoluteLayout android:layout_width="1024px" android:id="@+id/
levelView"
    android:background="@drawable/solid_white"
android:layout_height="1024px" android:minHeight="1024px"
android:minWidth="1024px">
  </AbsoluteLayout>
  </LinearLayout>
</ScrollView>

The 1024px are set to test but should be dynamically set to the needed
width and height during runtime.
Vertically scrolling works, but I do not get it horizontally scrolling
too.
See the screen shot of the 'Layout level' view in action:
 http://wiki.rocrail.net/doku.php?id=androc-intro-en #qvga_gallery

Any advice? Or do I have a design problem in this layout?

Best regards,
Rob Versluis.
 http://www.rocrail.net 

--



Other Threads

1. IM application on Android cupcake emulator

Hi,

I follow the instruction here to install Android cupcake emulator 1.5 r2:
http://developer.android.com/sdk/1.5_r2/installing.html

And i create
$ android create avd -n my_android1.5 -t 2

and i run
$ emulator -avd my_android1.5

but when the emulator starts, i don't see the IM application (not the
Gtalk one) , can you please tell me how to find the IM application
(the one with blue and red circles icon) that is on G1 phone??

Thank you.

--~--~---------~--~----~------------~-------~--~----~

2. isFirst on cursor is not returning false each time!!!!!!!!!!!!!!!

I am using android SDK1.5 r_1.I am querying the callLog  for call
history!!!
problem
here is my code!!!!!!!!!!!!!
package com.arka.CallLogDemo;

//import java.sql.Date;
import java.util.ArrayList;


import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
//import android.text.format.DateFormat;
//import android.text.format.DateUtils;

public class CallLogDemo extends ListActivity {/* ListActivity is a
Activity that display items by binding it to a data source such as a
cursor or array
and exposes event handlers when users select them*/
     /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        callDialog("start");
        // Querying for a cursor is like querying for any SQL-Database
        Cursor c = getContentResolver().query(/*Cursor interface
provides random read-write access to the result set returned by a
database query.*/
                  android.provider.CallLog.Calls.CONTENT_URI,//which
dataset
                  null, null, null,
                  android.provider.CallLog.Calls.DATE + " DESC");//
ordered by
        startManagingCursor(c);/*A managed Cursor handles all of the
niceties, such as unloading itself when the activity pauses, and
requerying itself when the activity restarts*/

        // Retrieve the column-indexes of phoneNumber, date and
calltype
        int numberColumn = c.getColumnIndex(
                  android.provider.CallLog.Calls.NUMBER);
        int dateColumn = c.getColumnIndex(
                  android.provider.CallLog.Calls.DATE);
        // type can be: Incoming, Outgoing or Missed
        int typeColumn = c.getColumnIndex(
                  android.provider.CallLog.Calls.TYPE);
        callDialog("start Arraylist");
        // Will hold the calls, available to the cursor
        ArrayList<IconifiedText> callList = new
ArrayList<IconifiedText>();
        callDialog("created  Arraylist");
        //Boolean flag=c.moveToFirst();
        // Loop through all entries the cursor provides to us.

        /*if (flag==true)
                callDialog("true");
        else
                        callDialog("false");
        callDialog("count "+c.getPosition());*/


        if(c!=null)
        {
                callDialog("not null");

        if(!c.moveToFirst())//**********ERROR******always returning
false!!!!!!!!!!!!!!
                             do{

                  String callerPhoneNumber = c.getString
(numberColumn);

                  //int callDate = c.getInt(dateColumn);*************
                  int callType = c.getInt(typeColumn);
                  callDialog("before case");
                  Drawable currentIcon = null;
                  switch(callType){
                       case
android.provider.CallLog.Calls.INCOMING_TYPE:
                            currentIcon = getResources().getDrawable
(R.drawable.in);
                            break;
                       case
android.provider.CallLog.Calls.MISSED_TYPE:
                            currentIcon = getResources().getDrawable
(R.drawable.missed);
                            break;
                       case
android.provider.CallLog.Calls.OUTGOING_TYPE:
                            currentIcon = getResources().getDrawable
(R.drawable.out);
                            break;
                  }
                  callDialog("after case");
                  // Convert the unix-timestamp to a readable
datestring
                  String dateString=c.getString(dateColumn);
                  //String dateString = DateUtils.dateString
(callDate).toString();
                 /* long created = c.getLong(dateColumn);
                  Date date = new Date(created);
                  String dateString = DateUtils.formatDate(date);*/

                  callList.add(new IconifiedText("@ " + dateString
                            + "  | # " + callerPhoneNumber,
currentIcon));
             }while(c.moveToNext());

        //}



        // Create an ListAdapter that manages to display out
'callList'

        IconifiedTextListAdapter itla = new IconifiedTextListAdapter
(this);
        itla.setListItems(callList);
        this.setListAdapter(itla);
       // Done =)
        }
    }

    public void callDialog(CharSequence message )
    {
        final AlertDialog.Builder a=new AlertDialog.Builder(this);
        a.setMessage(message);
        a.setTitle("HelloAndroid");
        //a.wait(2000);
        a.setPositiveButton("close", new
DialogInterface.OnClickListener(){
                public void onClick(DialogInterface dialog,int whichButton)
                {

                        //a.setCancelable(true);

                }
        });


        a.show();
    }
}



--~--~---------~--~----~------------~-------~--~----~

3. UDP Connection

4. handling touch events in MapView

5. Beginner Help needed

6. Eclipse debug port problem (8700)

7. fBook on G2