Java Code Examples for android.widget.ListView.LayoutParams

The following are Jave code examples for showing how to use LayoutParams of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: pracler   File: PlayListsAdapter.java   Source Code and License Vote up 6 votes
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_playlistsrows, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    }

    TextView textView = (TextView) convertView.findViewById(R.id.view_title);
    textView.setText(playList.get(position));

    TextView listcount = (TextView) convertView.findViewById(R.id.view_countview);
    listcount.setText("");
    return convertView;
}
 
Example 2
Project: pracler   File: MusicListAdapter.java   Source Code and License Vote up 6 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_musicrows, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    };

    ImageView album = (ImageView) convertView.findViewById(R.id.view_album);
    album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image));
    TextView title = (TextView) convertView.findViewById(R.id.view_title);
    TextView artist = (TextView) convertView.findViewById(R.id.view_artist);

    title.setText(list.getItem(position).getTitle());
    artist.setText(list.getItem(position).getArtist() + " - " + list.getItem(position).getAlbum() + " - " + global.mMusicManager.convertToTime(list.getItem(position).getLength()));

    convertView.setTag(list.getItem(position).getUid_local());
    MyAsyncTask myAsyncTask = new MyAsyncTask();
    myAsyncTask.setImgView(album);
    myAsyncTask.execute(position + "");

    return convertView;
}
 
Example 3
Project: pracler   File: SongListAdapter.java   Source Code and License Vote up 6 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_musicrows, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    };

    ImageView album = (ImageView) convertView.findViewById(R.id.view_album);
    album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image));
    TextView title = (TextView) convertView.findViewById(R.id.view_title);
    TextView artist = (TextView) convertView.findViewById(R.id.view_artist);

    title.setText(list.get(position).title);
    artist.setText(list.get(position).artist + " - " + list.get(position).album + " - " + global.mMusicManager.convertToTime(list.get(position).length));

    convertView.setTag(list.get(position).uid);
    MyAsyncTask myAsyncTask = new MyAsyncTask();
    myAsyncTask.setImgView(album);
    myAsyncTask.execute(position + "");

    return convertView;
}
 
Example 4
Project: pracler   File: ProfileMenuAdapter.java   Source Code and License Vote up 6 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = new ProfileRow(context);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    }

    final ProfileRow v = (ProfileRow) convertView;

    v.setText(followingList.get(position).name);
    UpdateView updateView = new UpdateView();
    updateView.setImageView(v.imageView);
    updateView.execute(followingList.get(position).picture);

    convertView = v;

    return convertView;
}
 
Example 5
Project: CSipSimple   File: IcsListPopupWindow.java   Source Code and License Vote up 6 votes
private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0);
        child.setLayoutParams(p);
    }
    //XXX p.viewType = mAdapter.getItemViewType(position);
    //XXX p.forceAdd = true;

    int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(), p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
        childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
        childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
}
 
Example 6
Project: pracler   File: TopMusicAdapter.java   Source Code and License Vote up 5 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_musicrows, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    }

    RelativeLayout lv =  (RelativeLayout) convertView.findViewById(R.id.lv);
    ImageView album = (ImageView) convertView.findViewById(R.id.view_album);
    album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image));
    TextView title = (TextView) convertView.findViewById(R.id.view_title);
    TextView artist = (TextView) convertView.findViewById(R.id.view_artist);

    MusicDto musicDto = global.mMusicManager.getMusicDto(list.get(position).uid+"");

    title.setText(musicDto.getTitle());
    artist.setText(
            list.get(position).count + "회 ėžŽėƒ - " +
            musicDto.getArtist() + " - " +
            musicDto.getAlbum() + " - " +
            global.mMusicManager.convertToTime(musicDto.getLength()));

    convertView.setTag(musicDto.getUid_local());
    MyAsyncTask myAsyncTask = new MyAsyncTask();
    myAsyncTask.setImgView(album);
    myAsyncTask.execute(musicDto.getAlbumId());

    return convertView;
}
 
Example 7
Project: pracler   File: PlayListAdapter.java   Source Code and License Vote up 5 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_playlistrows, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    }

    MusicDto music = global.mMusicManager.getMusicDto(list.get(position)+"");

    ImageView album = (ImageView) convertView.findViewById(R.id.view_album);
    album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image));
    TextView title = (TextView) convertView.findViewById(R.id.view_title);
    TextView artist = (TextView) convertView.findViewById(R.id.view_artist);

    title.setText(music.getTitle());
    artist.setText(music.getTitle() + " - " + music.getAlbum() + " - " + global.mMusicManager.convertToTime(music.getLength()));

    convertView.setTag(music.getUid_local());
    MyAsyncTask myAsyncTask = new MyAsyncTask();
    myAsyncTask.setImgView(album);
    myAsyncTask.execute(position + "");


    return convertView;
}
 
Example 8
Project: pracler   File: MenuListAdapter.java   Source Code and License Vote up 5 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        convertView = inflater.inflate(R.layout.view_list_dialogmenu, parent, false);
        ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
        convertView.setLayoutParams(layoutParams);
    }

    TextView textView = (TextView) convertView.findViewById(R.id.textview);
    textView.setText(list.get(position));
    return convertView;
}
 
Example 9
Project: ShangHanLun   File: ATableView.java   Source Code and License Vote up 4 votes
@Override
protected void onAttachedToWindow() {
    mAdapter = new ATableViewAdapter(this);

    // TODO we should handle the case last row is
    // ListView.LayoutParams.WRAP_CONTENT, to get its height.
    // setup footer for plain tables to complete its height with empty rows.
    // ATTENSION: below has a bug which cause listview dead for no move
    // except be killed.
    // so I commented it.
    // setupFooterView(mAdapter.getLastRowHeight());

    if (needPinnedHeader()) {
        // TO DO: here can remove to PinnedView class.
        View HeaderView = LayoutInflater.from(getContext()).inflate(
                R.layout.pinnedheader, this, false);
        Resources res = getResources();
        Rect padding = new Rect();
        padding.left = (int) res
                .getDimension(R.dimen.atv_plain_section_header_padding_left);
        padding.right = (int) res
                .getDimension(R.dimen.atv_plain_section_header_padding_right);

        // set background for plain style.
        // HeaderView
        // .setBackgroundResource(R.drawable.plain_header_background);
        HeaderView.setBackgroundColor(Color.argb(178, 204, 204, 204));
        TextView label = (TextView) HeaderView.findViewById(R.id.textLabel);
        label.setTextColor(Color.BLUE);
        HeaderView.setPadding(padding.left, padding.top, padding.right,
                padding.bottom);
        ListView.LayoutParams params = new ListView.LayoutParams(
                ListView.LayoutParams.MATCH_PARENT,
                mAdapter.getHeaderFooterRowHeight(0, false));
        HeaderView.setLayoutParams(params);
        HeaderView.requestLayout();

        setHeaderView(HeaderView);
    }
    // setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setAdapter(mAdapter);
    setOnScrollListener(mAdapter);
    setOnItemClickListener(new ATableViewCellClickListener(this));
    super.onAttachedToWindow();
}