Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ListView

Featured Replies

Posté(e)

Bonjour,

Je suis un peu noob en la matière don j'espère que vous allez m'aider amis Androidien(ne)s :)

Donc voila j'ai créé une listview qui s'affiche (ouf, c'est déjà ça... !) avec plusieurs éléments.

Je voudrais, qu'au clic sur un élément de la listview principale arrive une deuxième listview, secondaire, affichant d'autres éléments cliquables...

Shéma (elt = élément) :

Elt1 de la listview principale =>clic=> listview apparait avec d'autres sous-choix cliquables.

Elt2 de la listview principale =>clic=> listview apparait avec d'autres sous-choix cliquables.

Elt3...

Et ainsi de suite...

[source code]

Voici mon Main.java :

public class Bulle extends ListActivity implements OnClickListener{

private String[] mStrings = {"A", "B", "C", "D", "E", "F", "G",

"H", "I"};

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings);

setListAdapter(adapter);

}

public void onClick(View arg0) {

// TODO Auto-generated method stub

}

Mon main.xml :

<?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:clickable="true"

>

<ListView android:id="@android:id/list"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

>

</ListView>

</LinearLayout>

[/End of source code]

Que dois faire dans mon code source pour pouvoir faire ça ? Je comprends rien aux IDs, et comment l'appli sait quel choix dans la liste on a cliqué... etc....

Anyone help ? :) Aide ?

Posté(e)

Bonjour,

Deux possibilités :

- soit tu fais une liste extensible ;

- soit tu utilises un seconde activité pour ta sous liste ;

Bon courage,

ichpa

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.