bonjour;
je voudrais partager l'écran en 4 parties égales ;dans mon activité xml l'écran est bien partagé en 4;mais dans mon smartphone seuls les textviews 3 et 4 occupent tout l'écran 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
public class Grid5Activity extends AppCompatActivity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid5);
    }
 
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_grid5, menu);
        return true;
    }
 
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
 
        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }
 
        return super.onOptionsItemSelected(item);
    }
}
rien de changé
et mon xml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Grid5Activity">
 
 
    <GridLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:columnCount="2"
        android:rowCount="2">
 
        <TextView
 
 
 
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text1"
            android:id="@+id/textView"
            android:textColor="#000000"
            android:gravity="center"
            android:layout_gravity="fill"
            android:layout_column="0"
            android:layout_row="0"
            android:layout_columnSpan="1"
            android:layout_rowSpan="1" />
 
        <TextView
 
 
 
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text2"
            android:id="@+id/textView2"
            android:textColorHint="#000000"
 
            android:gravity="center"
            android:layout_gravity="fill"
            android:layout_column="1"
            android:layout_row="0"
            android:layout_columnSpan="1"
            android:layout_rowSpan="1"
            android:background="#fd0800" />
 
        <TextView
 
 
 
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text3"
            android:id="@+id/textView3"
            android:textColor="#000000"
            android:layout_gravity="fill"
            android:gravity="center"
            android:layout_column="0"
            android:layout_row="1"
            android:layout_columnSpan="1"
            android:background="#00ff00"
            android:layout_rowSpan="1" />
 
        <TextView
 
 
 
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text4"
            android:id="@+id/textView4"
            android:textColor="#000000"
            android:layout_gravity="fill"
            android:gravity="center"
            android:layout_column="1"
            android:layout_row="1"
            android:layout_columnSpan="1"
            android:background="#fbff4a"
            android:layout_rowSpan="1"
            android:autoText="true" />
    </GridLayout>
</RelativeLayout>
tous les parametres ne sont peut etre pas necessaires
merci pour vos réponses