Mouvements des view

Résolu
jimdano Messages postés 16 Date d'inscription mercredi 7 avril 2010 Statut Membre Dernière intervention 20 mars 2013 - 21 janv. 2013 à 18:25
jimdano Messages postés 16 Date d'inscription mercredi 7 avril 2010 Statut Membre Dernière intervention 20 mars 2013 - 21 janv. 2013 à 23:06
Bonjour,

J'ai un soucis et je ne trouve pas de solutions à mon problème sur internet...

J'ai un LinearLayout dans lequel j'ai mit 2 textview et un ListView.

j'ai mit tout d'abord un textView, la listView et l'autre textView.

j'aimerais bien que la taille initiale de la listView soit de 0, afin d'avoir les deux

textview l'un en dessous de l'autre et qu'a la réaction d'appui sur la première

textView, la listView apparaisse et la seconde textView descende

voici mon code :

<TextView
        	     android:id="@+id/inc_lieux"
        	     android:layout_width="match_parent"
        	     android:layout_height="44dp"
        	     android:layout_marginLeft="20dp"
        	     android:layout_marginTop="5dp"
        	     android:layout_weight="0.5"
        	     android:gravity="center_horizontal"
        	     android:paddingLeft="7dp"
        	     android:paddingRight="20dp"
        	     android:textColor="#efefef"
        	     android:textSize="16sp" />
        	 
        	 <ListView
        	     android:id="@+id/list_inc"
     android:layout_width="match_parent"
     android:layout_height="0dp"
 android:scrollbarAlwaysDrawVerticalTrack="true"
 android:visibility="invisible"
         android:paddingLeft="7dp"
                 android:paddingRight="20dp"
        	 android:textColor="#efefef"
        	 android:layout_marginLeft="20dp"
            	 android:layout_marginTop="5dp"
            	 android:layout_weight="20"/>
        	 
        	 <TextView
        	     android:id="@+id/inc_parti"
        	     android:layout_width="match_parent"
        	     android:layout_height="44dp"
        	     android:layout_marginLeft="20dp"
            	     android:layout_marginTop="5dp"
        	     android:gravity="center_horizontal"
        	     android:paddingLeft="7dp"
        	     android:paddingRight="20dp"
        	     android:textColor="#efefef"
        	     android:textSize="16sp"
        	     android:layout_weight="0.5" />


et mon code java qui essaye tant bien que mal de faire quelque chose ...

final TextView lieuINC = (TextView) findViewById(R.id.inc_lieux);
lieuINC.setText("x véhicules sur les lieux");

final ListView lINC = (ListView) findViewById(R.id.list_inc);
String[] values = new String[] { "VSAV, VSR, FPT, CCFM, VAR, VARI, FEV, PEVSD, VLCG" };

// Define a new Adapter
// First parameter - Context
// Second parameter - Layout for the row
// Third parameter - ID of the TextView to which the data is written
// Forth - the Array of data

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


// Assign adapter to ListView
lINC.setAdapter(adapter); 
lieuINC.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
lINC.setVisibility(View.VISIBLE);
}
});


Merci d'avance :)

1 réponse

jimdano Messages postés 16 Date d'inscription mercredi 7 avril 2010 Statut Membre Dernière intervention 20 mars 2013
21 janv. 2013 à 23:06
trouvé, il faut mettre la liste view en gone...
3
Rejoignez-nous