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>