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 :

Eléments cachés par le Linear?


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 10
    Par défaut Eléments cachés par le Linear?
    Bonjour !


    Je me confronte à un soucis (qui peut-être va sembler simple, codeurs aguerris).

    Mes images ("img1" et "img2") d'ImageButton ne s'affichent plus...
    Elles passent derrière le Linear il me semble pourtant que la structure de mes balises est bonne (?)

    Petite précision : s'il y autant de LinearLayout ouverts c'est pour pouvoir afficher un background différent à chaque image


    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
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    <?xml version="1.0" encoding="utf-8"?>
     
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        tools:ignore="ContentDescription"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
     
        <ImageButton
            android:layout_width="35dp"
            android:layout_height="71dp"
            android:layout_alignParentBottom="true"
            android:layout_marginStart="10dp"
            android:src="@drawable/img1"
            android:id="@+id/imageButton" />
     
        <ImageButton
            android:layout_width="45dp"
            android:layout_height="71dp"
            android:layout_alignParentEnd="true"
            android:layout_alignTop="@+id/imageButton"
            android:layout_marginEnd="12dp"
            android:src="@drawable/img2" />
            android:id="@+id/imageButton" />
     
        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
     
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
     
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="#ffb8e986">
     
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="180dp"
                        android:layout_marginBottom="180dp"
                        android:background="#ffb8e986"
                        android:src="@drawable/pic1"/>
     
                </LinearLayout>
     
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="#ffde3c50">
     
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="180dp"
                        android:layout_marginBottom="180dp"
                        android:background="#ffde3c50"
                        android:src="@drawable/pic2"/>
     
                </LinearLayout>
     
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="#ff9b9b9b">
     
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="180dp"
                        android:layout_marginBottom="180dp"
                        android:background="#ff9b9b9b"
                        android:src="@drawable/pic3" />
     
                </LinearLayout>
     
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="#a5468ad9">
     
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="180dp"
                        android:layout_marginBottom="180dp"
                        android:background="#a5468ad9"
                        android:src="@drawable/pic4" />
     
                </LinearLayout>
     
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="#fff9ec4f">
     
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="180dp"
                        android:layout_marginBottom="180dp"
                        android:background="#fff9ec4f"
                        android:src="@drawable/pic5" />
     
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    </RelativeLayout>
    J'espère que quelqu'un pourra la déceler pour me permettre d'avancer tranquillou dans mon boulot parce que pour l'instant, ça me bloque pas mal


    Bien à vous,

    Akelato

  2. #2
    Modérateur
    Avatar de grunk
    Homme Profil pro
    Lead dév - Architecte
    Inscrit en
    Août 2003
    Messages
    6 693
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Lead dév - Architecte
    Secteur : Industrie

    Informations forums :
    Inscription : Août 2003
    Messages : 6 693
    Par défaut
    Ta ScrollView est par dessus les premier bouton car tu ne lui donne aucune contrainte de position, donc elle commence en haut à gauche et fait la taille de son parent.
    Il faut contraindre ta scrollview sous les boutons par exemple si c'est ca que tu veux.
    Pry Framework php5 | N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre habitué
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 10
    Par défaut
    Citation Envoyé par grunk Voir le message
    Ta ScrollView est par dessus les premier bouton car tu ne lui donne aucune contrainte de position, donc elle commence en haut à gauche et fait la taille de son parent.
    Il faut contraindre ta scrollview sous les boutons par exemple si c'est ca que tu veux.
    L'idée était que les boutons soient statiques par rapport aux autres images scrollables :/


    Donc je comprend un peu mieux, je t'en remercie Gunk.

    Comment pourrais-je m'y prendre pour la contraindre? Dans mon fichier java?


    (Je tiens à préciser que sur le background de l'image n°4, quand je scroll, les deux boutons apparaissent, puis arrivé au background de la n°5 ils disparaissent )

  4. #4
    Modérateur
    Avatar de grunk
    Homme Profil pro
    Lead dév - Architecte
    Inscrit en
    Août 2003
    Messages
    6 693
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Lead dév - Architecte
    Secteur : Industrie

    Informations forums :
    Inscription : Août 2003
    Messages : 6 693
    Par défaut
    Voir les positionnements dans un Relativelayout : https://developer.android.com/guide/.../relative.html

    Ce qui pourrait donner un truc comme :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/imageButton">
    Sauf que dans ton cas , tu as plusieurs id identique , ce qui est formellement interdit
    Pry Framework php5 | N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  5. #5
    Membre habitué
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 10
    Par défaut
    Citation Envoyé par grunk Voir le message
    Voir les positionnements dans un Relativelayout : https://developer.android.com/guide/.../relative.html

    Ce qui pourrait donner un truc comme :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/imageButton">
    Sauf que dans ton cas , tu as plusieurs id identique , ce qui est formellement interdit
    Merci de ta réponse

    J'ai modifié tous les id pour qu'ils ne soient plus identiques, j'ai rajouté la ligne android:layout_below="@id/imageButton1" (j'ai essayé avec imageButton2 également) mais malheureusement, tout disparaît pour laisser place juste au deux boutons...
    Le scrollview a disparu


    Je me suis donc documenté sur ton lien et j'ai trouvé l'attribut layout_above, que j'ai essayé à la place du layout_below.
    Résultat : tout s'affiche correctement (le Scrollview et les deux imageButton en bas) mais (oui y a un "mais" sinon c'est po drôle),
    les deux imageButton sont affichés en bas de page dans un rectangle blanc.

    Je voudrais ce rectangle blanc simplement de la même couleur que le background défilant dans le scrollview, transparent quoi x).


    Vu la complication, ne serait-il pas plus judicieux d'utiliser des fragments?


    En tout cas merci de ton aide.
    J'apprends de mes erreurs

  6. #6
    Modérateur
    Avatar de grunk
    Homme Profil pro
    Lead dév - Architecte
    Inscrit en
    Août 2003
    Messages
    6 693
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Lead dév - Architecte
    Secteur : Industrie

    Informations forums :
    Inscription : Août 2003
    Messages : 6 693
    Par défaut
    les deux imageButton sont affichés en bas de page dans un rectangle blanc.

    Je voudrais ce rectangle blanc simplement de la même couleur que le background défilant dans le scrollview, transparent quoi x).
    j'imagine que tes boutons sont dans un conteneur , suffit donc de changer la couleur de fond ce layout ...

    Sinon l'éditeur graphique pour construire ces vues ca facilite les choses , encore plus si tu utilise un ConstraintLayout à la place d'un relativelayout.

    Vu la complication, ne serait-il pas plus judicieux d'utiliser des fragments?
    Des fragments c'est pas fait pour simplifier une interface.
    Pry Framework php5 | N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

Discussions similaires

  1. ToolTipText caché par d'autres éléments
    Par Seb33300 dans le forum AWT/Swing
    Réponses: 6
    Dernier message: 12/02/2007, 10h47
  2. Réponses: 3
    Dernier message: 05/02/2007, 15h15
  3. Menu caché par Canvas
    Par Mnwjin dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 01/12/2006, 19h58
  4. [CSS]SELECT dernier caractère caché par la flèche
    Par lodan dans le forum Mise en page CSS
    Réponses: 15
    Dernier message: 08/11/2006, 15h37
  5. Réponses: 4
    Dernier message: 15/12/2003, 17h46

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