SORU
27 Aralık 2012, PERŞEMBE


Nasıl dolgu öğesi bölücü line Liste Görünümü atamak

enter image description here

Nasıl dolgu gösteriyorum olarak madde listesi için görüntü vermek istiyorum.

bu liste benim kod parçası

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp">

 <ListView 
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
     android:id="@ id/listV_main"
    android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"/>

Bu Liste bölüm kodum

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp">
<include
    android:id="@ id/list_item_section_text"
    layout="@android:layout/preference_category"
     />

Bu liste öğesi benim kodudur

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:adjustViewBounds="true"
android:paddingRight="?android:attr/scrollbarSize"
   >
<ImageView
    android:id="@ id/showlist_item_entry_drawable"
    android:layout_width="82dp"
    android:adjustViewBounds="true"
    android:layout_height="68dp"
    android:scaleType="fitXY"
    android:paddingLeft="9dp"/> 
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dip"
    android:layout_marginRight="6dip"
    android:layout_marginTop="6dip"
    android:layout_marginBottom="6dip"
    android:layout_weight="1"
>
    <TextView android:id="@ id/list_item_entry_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal" /> 
    <TextView android:id="@ id/list_item_entry_summary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/list_item_entry_title"
        android:layout_alignLeft="@id/list_item_entry_title"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:singleLine="true"
        android:textColor="?android:attr/textColorSecondary" />
</RelativeLayout>

Bu Girişi, adaptör benim kodudur

public class EntryAdapter extends ArrayAdapter<Item> {
private Context context;
private ArrayList<Item> items;
private LayoutInflater vi;
Uri myurl;
ImageView image;
public EntryAdapter(Context context,ArrayList<Item> items) {
    super(context,0, items);
    this.context = context;
    this.items = items;
    vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    final Item i = items.get(position);
    if (i != null) {
        if(i.isSection()){
            SectionItem si = (SectionItem)i;
            v = vi.inflate(R.layout.list_item_section, null);
            v.setOnClickListener(null);
            v.setOnLongClickListener(null);
            v.setLongClickable(false);
            final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
            sectionView.setText(si.getTitle());
            String name = "Today";
            if(si.getTitle().equalsIgnoreCase(name))
            {
            sectionView.setPadding(25, 0, 0, 0);
            }
            else
            {
                sectionView.setPadding(15, 0, 0, 0);
            }
        }else
          {
            EntryItem ei = (EntryItem)i;
            v = vi.inflate(R.layout.list_item_entry, null);
            v.setPadding(10, 10, 10, 10);
            final TextView title = (TextView)v.findViewById(R.id.list_item_entry_title);
            final TextView subtitle = (TextView)v.findViewById(R.id.list_item_entry_summary);
            image = (ImageView)v.findViewById(R.id.showlist_item_entry_drawable);
            image.getLayoutParams().height = 143;
            image.getLayoutParams().width = 150;
            image.setPadding(7, 7, 7, 7);
            if (title != null) 
                title.setText(ei.title);
            if(subtitle != null)
                subtitle.setText(ei.subtitle);
            UrlImageViewHelper.setUrlDrawable(image,ei.img_url);

          }
        }
    return v;
    }

CEVAP
27 Mayıs 2013, PAZARTESİ


'....'. İç metin kullanın

(list_divider.xml)

<?xml version="1.0" encoding="UTF-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:insetLeft="50dp"
    android:insetRight="50dp" >

 <shape>
    <solid android:color="@color/orange" />
    <corners android:radius="2.0dip" />
</shape>

</inset>

ve liste görünümünde bu gibi ekleyin...

<ListView
    android:dividerHeight="2dp"
    android:divider="@drawable/list_divider"
    ...
/>

istediğiniz kadar İç metin değerini ayarlayın

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Cartoonium

    Cartoonium

    11 NİSAN 2011
  • CasinoRoyaleMovie's channel

    CasinoRoyale

    1 AĞUSTOS 2006
  • Vagrant Records

    Vagrant Reco

    8 Mayıs 2006