Répondre

0

ajouter à votre activité pour obtenir le changement d'orientation:

@Override 
public void onConfigurationChanged(Configuration newConfig) { 
    super.onConfigurationChanged(newConfig); 
    if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { 
     //PORTRAIT MODE 
     adapter.screenChanged("PORTRAIT"); 
    } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { 
     //LANDSCAPE MODE 
     adapter.screenChanged("LANDSCAPE"); 
    } 
} 

Ajouter à votre adaptateur

public void screenChanged(String orientation){ 
     if (orientation.equals("PORTRAIT")){ 
      //code 
     }else{ 
      //code 
     } 
    } 
+0

La principale question est: comment informer tous les 'ViewHolder' comprennent ceux qui sont hors de l'écran – TOP

+0

ce que vous entendez par hors de l'écran –

+0

Je veux dire, par exemple: nous avons 6 objets ViewHolder. 4 d'entre eux sont à l'écran (nous avons 4 éléments à l'écran). Et 2 d'entre eux ne sont pas affichés sur l'écran – TOP