Bonjour,
Je souhaite afficher des boutons dans un PopupWindow et effectuer des actions aux cliques des boutons. Le problème ne viens pas de cette partie, mais de l’absence de l’animation habituel des boutons lorsqu’on appuis dessus.
Pourriez-vous m’aidez ? Je n’arrive pas vraiment à identifier la source de mon problème.
Voici le code et le layout associé au popup où il y a mon problème :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 final Button BOpenPopup = (Button)findViewById(R.id.openpopup); BOpenPopup.setOnClickListener(new OnClickListener() { public void onClick(View v) { LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popupwin, null); final PopupWindow popWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popWindow.showAsDropDown(BOpenPopup); Button BDismiss = (Button)popupView.findViewById(R.id.dismiss); BDismiss.setOnClickListener(new OnClickListener() { public void onClick(View v) { Log.d("PopupWin", "Clique du bouton"); } }); } });
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@android:color/background_light"> <Button android:id="@+id/dismiss" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:text="Button" /> </LinearLayout>
Partager