Hi can any one please respond me my list is scrolling this list should
be not be scrolling can any guide below the code

On Tue, Nov 29, 2011 at 8:33 PM, jaggu <[email protected]> wrote:
> Hi
> iam useing list actvity should not be scroll can any one tell me for
> ths guidance
>
>
> package com.android.wt360weather.more;
>
> import java.io.UTFDataFormatException;
> import java.util.HashMap;
>
> import android.app.ListActivity;
> import android.content.Context;
> import android.content.Intent;
> import android.content.res.Resources;
> 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.ImageView;
> import android.widget.ListView;
> import android.widget.TabHost;
> import android.widget.TextView;
>
> import com.android.wt360weather.R;
>
> public class More extends ListActivity {
>
>        /** Called when the activity is first created. */
>
>
>        int[] imageIds = { R.drawable.maps, R.drawable.severe, 
> R.drawable.settings,
>                        R.drawable.swipe, R.drawable.blog, R.drawable.web,
>                        R.drawable.feedback, R.drawable.art };
>        String[] texts;
>        MoreAdapter adapter;
>        Resources res;
>        HashMap<Object, Object> htMap=new HashMap<Object, Object>();
>        @Override
>        public void onCreate(Bundle savedInstanceState) {
>                super.onCreate(savedInstanceState);
>                setContentView(R.layout.more);
>                texts = getResources().getStringArray(R.array.more);
>                adapter = new MoreAdapter(this, 
> android.R.layout.simple_list_item_2,
>                                texts);
>                setListAdapter(adapter);
>
>
>        }
>
>        class MoreAdapter extends ArrayAdapter {
>                private LayoutInflater mInflater;
>
>                public MoreAdapter(Context context, int textViewResourceId,
>                                String[] items) {
>                        super(context, textViewResourceId, items);
>                        mInflater = LayoutInflater.from(context);
>                        // TODO Auto-generated constructor stub
>                }
>
>                @Override
>                public View getView(int position, View convertView, ViewGroup 
> parent) {
>                        // TODO Auto-generated method stub
>
>                        View listView;
>                        if (convertView == null) {
>                                listView = 
> mInflater.inflate(R.layout.moreview, null);
>                        } else
>                                listView = convertView;
>                        TextView label = (TextView) 
> listView.findViewById(R.id.label);
>                        label.setText(texts[position]);
>
>                        ImageView icon = (ImageView) 
> listView.findViewById(R.id.icon);
>                        icon.setImageResource(imageIds[position]);
>                        return listView;
>                }
>        }
>
>        public void onListItemClick(ListView parent, View v, int position, 
> long id) {
>
>                if (position == 0) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this, InteractiveMaps.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 1) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this,
>                                        ActiveSevereAlerts.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 2) {
>
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this,
>                                        Setting.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 3) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this, Swipe.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 4) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this, Wt360Blog.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 5) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this, Wt360comWebsite.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 6) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this, Feedback.class);
>
>                        startActivity(myintent);
>                }
>                if (position == 7) {
>                        Intent myintent = new Intent();
>                        myintent.setClass(More.this,
>                                        SetBackgroundImage.class);
>                        startActivity(myintent);
>                }
>        }
> }
> layout main:
>
> <?xml version="1.0" encoding="utf-8"?>
> <ListView xmlns:android="http://schemas.android.com/apk/res/android";
>    android:id="@android:id/list"
>    android:layout_width="match_parent"
>    android:layout_height="match_parent"
>    />
>
> listlayout:
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout
>  xmlns:android="http://schemas.android.com/apk/res/android";
>  android:orientation="vertical"
>  android:layout_width="wrap_content"
>  android:layout_height="wrap_content"
>  android:background="#FFFF"
>    android:minHeight="?android:attr/listPreferredItemHeight"
>  >
>  <ImageView android:id="@+id/icon" android:layout_width="wrap_content"
>                android:layout_height="wrap_content" 
> android:layout_marginRight="6dip"
>                android:src="@drawable/icon" 
> android:layout_centerVertical="true"/>
>  <TextView android:id="@+id/label"
>  android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
>                        android:textSize="16sp"
>                         android:textStyle="bold"
>                        android:layout_toRightOf="@+id/icon"
>                        android:textColor="#000000"
>                        android:text="sample" 
> android:layout_centerInParent="true"/>
>    <TextView android:id="@+id/label_arrow"
>             android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:textSize="22sp"
>                         android:textStyle="bold"
>                         android:layout_alignParentRight="true"
>                         android:text=">" android:layout_centerVertical="true"
> android:gravity="right"/>
>
> </RelativeLayout>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to