小编mee*_*epz的帖子

Gridview多行Textview截止

我有一个GridView和每个单元有一个ImageViewTextView在它之下.不幸的是,如果TextView有多行,则文本会被切断.我已经尝试了一切,但我无法找到解决方案.

似乎行的高度GridView是问题,而不是实际文本,因为你可以看到文本中的一半Textview.

这是我的代码:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    GridView gridView = (GridView) findViewById(R.id.gridView1);
    gridView.setAdapter(new ImageAdapter());

    gridView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View v, int position, long id) {
            startActivity(new Intent(Main.this, Acronyms.class));
        }

    });
}

public class ImageAdapter extends BaseAdapter {

    private Integer[] iconImg = { 
            R.drawable.acronyms, R.drawable.acronyms,
            R.drawable.acronyms
    };
    private String[] iconTitle = {
            "Acronyms", "Cardiac Strips",
            "Test 3"
    };

    public int getCount() { …
Run Code Online (Sandbox Code Playgroud)

android gridview textview

8
推荐指数
2
解决办法
6984
查看次数

jQuery - .children()上的触发事件.size()更改

我已经搜索了很远但我无法弄清楚如何将一个监听器放在子元素的size()上.我想要做的是:

我有一个div,有0-6 +子元素.这个号码没有定义,因为我正在制作购物车.而不是onclick为每个可以改变购物车中的项目数量的按钮(即添加到购物车btn,空购物车按钮,更改数量等...)我希望有一个监听器,当$("#cart").children().size()更改时,if语句检查是否购物车中的#of不同项目大于3.如果是这样,请更改div的高度.

购物车布局的一个例子:

<div id='cart'>
     <div class='item'></div>
     <div class='item'></div>
</div>
Run Code Online (Sandbox Code Playgroud)

实际代码站点位于:http://www.jamesendres.com/projects/ad/throw-pillows.html

html css jquery

3
推荐指数
1
解决办法
8143
查看次数

Android设置后台资源和颜色

是否有可能设置backgroundResourcebackgroundColor一个自定义适配器的ListView/ExpandableListView的.

我有一个透明的png,它将作为可扩展列表视图中每行的边框.此图像只是内部阴影和底部边框.

目标是做这样的事情:

png +颜色

当我设置backgroundResource然后设置backgroundColor时,只显示两个中的一个.我无法获得覆盖颜色的资源.有谁知道这是否可能?

这是我的代码,以获得更好的主意:

private int[] colors2= new int[] { Color.parseColor("#e2e8e9"), Color.parseColor("#f1f2f2") };
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    ViewHolder holder;
    ExpandListGroup group = (ExpandListGroup) getGroup(groupPosition);
    if (convertView == null) {
        holder = new ViewHolder();
        LayoutInflater inf = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
        convertView = inf.inflate(R.layout.expandlist_group_item, null);
        holder.title = (TextView) convertView.findViewById(R.id.tvGroup);
        convertView.setTag(holder);
    }else{
        holder = (ViewHolder) convertView.getTag();
    }
    int colorPos = groupPosition % colors.length; 
    convertView.setBackgroundResource(R.drawable.row_forground);
    convertView.setBackgroundColor(color2[colorPos]);
    holder.title.setText(group.getName());
    return convertView;
}
Run Code Online (Sandbox Code Playgroud)

android

3
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×2

css ×1

gridview ×1

html ×1

jquery ×1

textview ×1