[android-developers] Re: Question about the Lsit View

2010-04-17 Thread SheikhAman
Google for Droiddraw first. it will give you a nice toll to draw all
ur layouts in android.

secondly, use an vertical linear layout, in it, add a text view, then
add a list view, then add a linear layout, inside linear layout, add
button1 and button2.
so the text view, list view and linear layout will appear vertically
stacked.
later in the second linear layout, add ur buttons.

hows this?

On Apr 16, 7:23 pm, desgraci care.n...@gmail.com wrote:
 Hi i'm new on this forum, i searched for a way to make divs in my
 android apps but i cant find any post of this theme, so i post what i
 want to do here:

 
 |        Text View |   not scrollbable
 
 |   List               |  Scrollbable
 
 | Button1Button2| not scrollbable
 -

 Also when i try to make a 1.6 android application, whit this code:

 HelloList.java

 package com.examples;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.ListView;
 import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.AdapterView.OnItemClickListener;

 public class HelloList extends ListActivity {
     private String[]
 COUNTRIES=getResources().getStringArray(R.array.countries_array);;

         /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
         this.setListAdapter(new ArrayAdapterString(this,
 R.layout.list_item, COUNTRIES));
         ListView lv = getListView();
         lv.setTextFilterEnabled(true);

         lv.setOnItemClickListener(new OnItemClickListener() {
             public void onItemClick(AdapterView? parent, View view,
                     int position, long id) {
                   // When clicked, show a toast with the TextView text
                   Toast.makeText(getApplicationContext(), ((TextView)
 view).getText(),
                       Toast.LENGTH_SHORT).show();
                 }
               });

     }

 }

 res/values/valores.xml

 ?xml version=1.0 encoding=utf-8?
 resources
     string-array name=countries_array
         itemBahrain/item
         itemBangladesh/item
         itemBarbados/item
         itemBelarus/item
         itemBelgium/item
         itemBelize/item
         itemBenin/item
     /string-array
 /resources

 res/values/string.xml

 ?xml version=1.0 encoding=utf-8?
 resources
     string name=helloHello World, HelloList!/string
     string name=app_nameHola Lista/string
 /resources

 res/values/list_item.xml

 ?xml version=1.0 encoding=utf-8?
 TextView xmlns:android=http://schemas.android.com/apk/res/android;
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     android:padding=10dp
     android:textSize=16sp 
 /TextView

 res/values/main.xml

 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
     android:orientation=vertical
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     
 TextView
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:text=@string/hello
     /
 /LinearLayout

 --
 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 
 athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Question about the Lsit View

2010-04-17 Thread patbenatar
No divs. If you want to use HTML/CSS markup, look into WebView.

For building a native Android UI, check out these links:
http://developer.android.com/guide/topics/ui/index.html
http://developer.android.com/guide/topics/ui/layout-objects.html

That DroidDraw tip given by SheikhAman is a great resource as well if
you don't want to build your layout manually with XML.

-Nick


On Apr 16, 11:13 pm, SheikhAman shekh.a...@gmail.com wrote:
 Google for Droiddraw first. it will give you a nice toll to draw all
 ur layouts in android.

 secondly, use an vertical linear layout, in it, add a text view, then
 add a list view, then add a linear layout, inside linear layout, add
 button1 and button2.
 so the text view, list view and linear layout will appear vertically
 stacked.
 later in the second linear layout, add ur buttons.

 hows this?

 On Apr 16, 7:23 pm, desgraci care.n...@gmail.com wrote:





  Hi i'm new on this forum, i searched for a way to make divs in my
  android apps but i cant find any post of this theme, so i post what i
  want to do here:

  
  |        Text View |   not scrollbable
  
  |   List               |  Scrollbable
  
  | Button1Button2| not scrollbable
  -

  Also when i try to make a 1.6 android application, whit this code:

  HelloList.java

  package com.examples;

  import android.app.ListActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;

  public class HelloList extends ListActivity {
      private String[]
  COUNTRIES=getResources().getStringArray(R.array.countries_array);;

          /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          this.setListAdapter(new ArrayAdapterString(this,
  R.layout.list_item, COUNTRIES));
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);

          lv.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView? parent, View view,
                      int position, long id) {
                    // When clicked, show a toast with the TextView text
                    Toast.makeText(getApplicationContext(), ((TextView)
  view).getText(),
                        Toast.LENGTH_SHORT).show();
                  }
                });

      }

  }

  res/values/valores.xml

  ?xml version=1.0 encoding=utf-8?
  resources
      string-array name=countries_array
          itemBahrain/item
          itemBangladesh/item
          itemBarbados/item
          itemBelarus/item
          itemBelgium/item
          itemBelize/item
          itemBenin/item
      /string-array
  /resources

  res/values/string.xml

  ?xml version=1.0 encoding=utf-8?
  resources
      string name=helloHello World, HelloList!/string
      string name=app_nameHola Lista/string
  /resources

  res/values/list_item.xml

  ?xml version=1.0 encoding=utf-8?
  TextView xmlns:android=http://schemas.android.com/apk/res/android;
      android:layout_width=fill_parent
      android:layout_height=fill_parent
      android:padding=10dp
      android:textSize=16sp 
  /TextView

  res/values/main.xml

  ?xml version=1.0 encoding=utf-8?
  LinearLayout xmlns:android=http://schemas.android.com/apk/res/
  android
      android:orientation=vertical
      android:layout_width=fill_parent
      android:layout_height=fill_parent
      
  TextView
      android:layout_width=fill_parent
      android:layout_height=wrap_content
      android:text=@string/hello
      /
  /LinearLayout

  --
  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 
  athttp://groups.google.com/group/android-developers?hl=en

 --
 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 
 athttp://groups.google.com/group/android-developers?hl=en

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