2011-07-20 11 views
0

私のアプリにフットボールリーグテーブルを表示する必要があります。 http://www.fuencalientedelapalma.org/sitios/Fuencaliente/VF7/PublishingImages/Clasificacion.pngどのように "サッカーリーグテーブル"スタイルでアンドロイドインターフェイスを作成するには?

私は、AndroidのXMLレイアウトを9列、10行、列の名前にもう1行追加する必要があることがわかります。

私はアンドロイドの開発者ガイドでlistviewのすべてのドキュメントを読んだが、私はそれを行う方法を見つけることができません。また、私はGoogleで検索し、私はそれを行う方法を見つけることができません。

コード例は、あなたがlistlayout所有膨らませる、このようにリストビューを使用することができます

おかげ

+0

実際にあなたが直面している問題 – ingsaurabh

答えて

1

歓迎されています:

maListViewPerso = (ListView) findViewById(R.id.listviewperso); 


    ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>(); 

    HashMap<String, String> map; 


    for (int i = 0; i<statDB.getListStat().size(); i++){ 
     Stat stat= statDB.getListStat().get(i); 
     listId.add(statDB.getListStat().get(i).getId()+""); 
     String message = " Chiffre d'affaire : "+statDB.getListFinancier(stat.getId()+"").get(0).getCaBrut()+" euros"; 

     map = new HashMap<String, String>(); 
     titre 
     map.put("titre", stat.getDate()); 

     map.put("description", message); 

     map.put("img", String.valueOf(R.drawable.icon_crisalid)); 
     map.put("stat_in",""+statDB.getListStat().get(i).getId()); 

     listItem.add(map); 
    } 


    statDB.close(); 


    SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.listview, 
      new String[] {"img", "titre", "description"}, new int[] {R.id.img, R.id.titre, R.id.description}); 


    maListViewPerso.setAdapter(mSchedule); 


    maListViewPerso.setOnItemClickListener(new OnItemClickListener() { 
     @Override 
     @SuppressWarnings("unchecked") 
     public void onItemClick(AdapterView<?> a, View v, int position, long id) { 

      HashMap<String, String> map = (HashMap<String, String>) maListViewPerso.getItemAtPosition(position); 
      Intent intent=new Intent().setClass(ListActivity.this, DetailActivity.class); 
      intent.putExtra("stat_in", map.get("stat_in")); 
      intent.putExtra("listId",listId); 

      startActivity(intent); 

     } 
    }); 

これは私のリストビューのコードです:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
> 

<ImageView 
    android:id="@+id/img" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 

    android:padding="20px" 
    /> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 
    android:paddingLeft="10px" 
    android:layout_weight="1" 
    > 

    <TextView android:id="@+id/titre" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:textSize="16px" 
     android:textStyle="bold" 
     android:textColor="@color/textcol" 
     /> 

    <TextView android:id="@+id/description" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:textSize="12px" 
     android:textColor="@color/textcol" 
     android:paddingRight="10px" 
     /> 

</LinearLayout> 

、これは私がリストビューをチェックする方法である:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@color/backgroundcolor" 
> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="fill_horizontal" 

    android:paddingTop="5px" 
    android:paddingBottom="5px" 
    android:background="@drawable/bg2" 
    > 


    <TextView 
     android:layout_weight="1" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     /> 




</LinearLayout> 


<ListView 
    android:id="@+id/listviewperso" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    /> 

あなただけのリストビューを調整する必要があります。

+0

あなたのコードで動作するxmlをどうやってやるのか分かりません。 – NullPointerException

+0

私はxmlを持っていた – Atheh

関連する問題