Bootstrap轮播与缩略图在单行

时间:2016-03-22 07:09:36

标签: javascript jquery html css twitter-bootstrap

这是我上一次 question

的扩展问题

当缩略图增加时,它会落入第2行。如何使其溢出(不希望水平滚动缩略图)并与前/下一个按钮一起移动。

   //Custom Adatpter
   package com.example.smsptclapp;
   import java.util.ArrayList;
   import java.util.List;
   import android.app.Activity;
   import android.content.Context;
   import android.content.Intent;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.View.OnClickListener;
   import android.view.ViewGroup;
   import android.widget.AdapterView;
   import android.widget.BaseAdapter;
   import android.widget.ImageView;
   import android.widget.TextView;
   import android.widget.Toast;
   import android.widget.AdapterView.OnItemLongClickListener;

   public class CustomAdapter extends BaseAdapter
    {
 static List<String> result;
 //ArrayList<SingleRow> list;
 Activity context;
 static TextView tv;
 static int k,count;
     // int [] imageId; //for Image
     private static LayoutInflater inflater = null;
    public CustomAdapter(Activity activity, List<String> prgmNameList) 
     {
       // TODO Auto-generated constructor stub
        result = prgmNameList;
        context = activity;
       //imageId = prgmImages; //for Image 
       inflater = ( LayoutInflater )context.getSystemService (Context.LAYOUT_INFLATER_SERVICE);
     }

     public CustomAdapter(OnClickListener onClickListener, List<String>  listItems) 
     {
    // TODO Auto-generated constructor stub
     }

 @Override
     public int getCount() 
     {
      // TODO Auto-generated method stub
      return result.size();
     }

     @Override
     public Object getItem(int position) 
     {
       // TODO Auto-generated method stub
       return position;
     }

     @Override
     public long getItemId(int position) 
     {
       // TODO Auto-generated method stub
       return position;
     }

     public static int getCounter()
    {
      return count;
    }

    public static int getPosition()
   {
     return k;
   }

   @Override
   public View getView(final int position, View convertView, ViewGroup   parent) 
   {
     // TODO Auto-generated method stub
     //Object cd1=   getItem(position);
     View rowView;       
     rowView = inflater.inflate(R.layout.program_list, null);
     tv=(TextView) rowView.findViewById(R.id.textView1);
     tv.setLongClickable(true);
     tv.setText(result.get(position));
      rowView.setOnClickListener(new OnClickListener() 
      {
         @Override
         public void onClick(View v) {
            k = position;
            Intent i =  new Intent(context, Menu.class);
            context.startActivity(i);
         }
         });
     return rowView;
    }
 }

 // In Main Type these lines
       ss =listItems.get(i);  // where 'ss' is global string, 'i' is the location you want to delete, and 'listItems' is global variable of 'List<String>' type. 
       db.deleteUser(ss);  //'db' is global variable of database and deleteUser is method to delete entry from data base only 
   listItems.remove(i); //to remove the entry from list i.e to refresh it you must call this
   listgroups.setAdapter(new CustomAdapter(this,listItems)); //'listgroups' is 'ListView', which is also global.

DEMO

0 个答案:

没有答案