IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

probleme dans mypattern4


Sujet :

Android

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    178
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 178
    Points : 43
    Points
    43
    Par défaut probleme dans mypattern4
    Bonjour;
    dans mon app ;n'apparait que la str de date;tandis que la str1 pour le recycler et l'edittext et la checkbox et le bouton n'apparaissent pas et je ne vois pas l'erreur;
    voici mon code
    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
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    public class Pattern4Activity extends AppCompatActivity {
        RecyclerView rec;
        private RecyclerView.LayoutManager lm;
        EditText et;
        TextView date;
        CheckBox cb;
        InputStream fis;
        String str2,strdate;
        StringBuilder sb;
        String str1="abcdefghijklmnopqrstuvwxyz\n";
     
        Rvadapter rv;
        ArrayList<Model> arl;
        Boolean bool = true,bool1=true,bool2=true;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_pattern4);
            rec= (RecyclerView) findViewById(R.id.rec);
            et= (EditText) findViewById(R.id.editText);
            date= (TextView) findViewById(R.id.date);
            cb= (CheckBox) findViewById(R.id.checkBox);
            lm = new LinearLayoutManager(getApplicationContext());
            rec.setLayoutManager(lm);
            rec.setHasFixedSize(true);
            sb=new StringBuilder();
            arl=new ArrayList<>();
             strdate="Database = 2016/04/11-8.29.02";
            preparearl();
            rv = new Rvadapter(arl);
            rec.setAdapter(rv);
            date.setText(strdate);
            rv.notifyDataSetChanged();
        }
        public void preparearl(){
            Model m=new Model("1"+str1);
            arl.add(m);
            m=new Model("2"+str1);
            arl.add(m);
            m=new Model("3"+str1);
            arl.add(m);
            m=new Model("4"+str1);
            arl.add(m);
            m=new Model("5"+str1);
            arl.add(m);
            m=new Model("6"+str1);
            arl.add(m);
                }
    }
    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
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    public class Rvadapter extends RecyclerView.Adapter<Rvadapter.Textholder>{
        ArrayList<Model> arl;
        Textholder holder;
        RecyclerView rec;
        View v;
        public class Textholder extends RecyclerView.ViewHolder {
            TextView t1;
     
            public Textholder(View itemView) {
                super(itemView);
                t1= (TextView) itemView.findViewById(R.id.textView);
     
            }
     
        }
        public Rvadapter(ArrayList<Model> arl){
            this.arl=arl;
        }
        @Override
        public Textholder onCreateViewHolder(ViewGroup parent, int viewType) {
            v = LayoutInflater.from(parent.getContext()).inflate(R.layout.rowdata, parent, false);
            holder = new Textholder(v);
            return holder;
        }
        @Override
        public void onBindViewHolder(Textholder holder, int position) {
            holder.t1.setText(arl.get(position).getmys());
        }
     
        @Override
        public int getItemCount() {
            return arl.size();
        }
     
     
    }
    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
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_pattern4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        tools:context="com.example.pa.mypattern4.Pattern4Activity">
     
        <TextView
            android:id="@+id/date"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Hello World!" />
     
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
     
            <EditText
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:inputType="text"
                android:ems="10"
                android:id="@+id/editText"
                android:layout_weight="1"
                android:hint="Recherche" />
     
            <CheckBox
                android:text="Mot entier"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/checkBox"
                android:layout_weight="1" />
     
            <Button
                android:text="Button"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/button"
                android:layout_weight="1" />
        </LinearLayout>
     
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/rec"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollbars="vertical" />
     
        </LinearLayout>
     
     
    </LinearLayout>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    ?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:background="#00ff00"
                android:id="@+id/textView"
                android:text="Bravo" />
     
    </LinearLayout>

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    178
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 178
    Points : 43
    Points
    43
    Par défaut
    il semblerait que ce soit un bug dans la version 25 en revenant a la version 23.1.1 tout est ok

Discussions similaires

  1. Probleme dans request.QueryString("chaine")
    Par soufienne dans le forum ASP
    Réponses: 8
    Dernier message: 24/08/2004, 14h49
  2. Probleme dans une procedure stockée
    Par malbaladejo dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 07/07/2004, 14h08
  3. petit probleme dans une requte POSTGRE SQL
    Par ghis le fou dans le forum Requêtes
    Réponses: 5
    Dernier message: 08/09/2003, 13h51
  4. Probleme dans une clause like !
    Par adil dans le forum Langage SQL
    Réponses: 6
    Dernier message: 15/07/2003, 16h47
  5. Probleme dans ma requete
    Par Kuroro dans le forum Requêtes
    Réponses: 2
    Dernier message: 11/07/2003, 11h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo