首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android弹出选择对话框-仿某团购网android客户端栏目抉择

2013-12-26 
android弹出选择对话框-仿某团购网android客户端栏目选择?效果图二:?未完善,还比较简单:? 弹出对话框,先只

android弹出选择对话框-仿某团购网android客户端栏目选择

?效果图二:

android弹出选择对话框-仿某团购网android客户端栏目抉择

?

未完善,还比较简单:

? 弹出对话框,先只显示左边列表,右边列表需要宽度设置为0,用visiable会影响使用。

?选中左边列表时,再根据数据情况展现右边或者是选中提交。

?

?

PopupCategory.java

package com.example.ysq.adapter;import java.util.List;import com.example.ysq.R;import com.example.ysq.entity.CategoryEntity;import android.content.Context;import android.graphics.Color;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.ImageView;import android.widget.TextView;public class CategoryAdapter extends BaseAdapter {private List<CategoryEntity> entityList;private LayoutInflater inflater;private int itemViewResource;private int index = 0;public CategoryAdapter(Context paramContext, List<CategoryEntity> entityList, int itemViewResource) {this.inflater = ((LayoutInflater) paramContext.getSystemService("layout_inflater"));this.entityList = entityList;this.itemViewResource = itemViewResource;}public void setData(List<CategoryEntity> paramList){this.entityList=paramList;notifyDataSetChanged();}private CategoryEntity b(int paramInt) {return (CategoryEntity) this.entityList.get(paramInt);}public final void setFocus(int index ) {this.index  = index ;notifyDataSetChanged();}public final int getCount() {if (isNull(this.entityList))return 0;return this.entityList.size();}public final long getItemId(int paramInt) {return paramInt;}public final View getView(int paramInt, View paramView,ViewGroup paramViewGroup) {CategoryEntity localwk = b(paramInt);ListItemView itemView;    if (paramView == null)    {      paramView = this.inflater.inflate(this.itemViewResource, paramViewGroup, false);      itemView = new ListItemView();      itemView.name = ((TextView)paramView.findViewById(R.id.name));      itemView.count = ((TextView)paramView.findViewById(R.id.count));      itemView.haschild = ((ImageView)paramView.findViewById(R.id.haschild));      paramView.setTag(itemView);    }else{    itemView = (ListItemView)paramView.getTag();    }    if(this.itemViewResource==R.layout.category_item){//父结构    if(localwk.getSeq()==this.index){    paramView.setBackgroundColor(Color.argb(255,234,234,234));//#ffeaeaea    }else{    paramView.setBackgroundDrawable(null);    }    }        itemView.name.setText(localwk.getName());      if (localwk.getCount() != -1)      itemView.count.setText(String.valueOf(localwk.getCount()));            if (isNull(localwk.getChildList()))      itemView.haschild.setVisibility(View.INVISIBLE);      else      itemView.haschild.setVisibility(View.VISIBLE);          return paramView;}static class ListItemView{  TextView name;  TextView count;  public ImageView haschild;}public <T> boolean isNull(List<T> paramList) {return (paramList == null) || (paramList.isEmpty());}@Overridepublic Object getItem(int arg0) {// TODO Auto-generated method stubreturn null;}}

?
?

热点排行