2011-08-24 1 views
0

Je me réfère à la vue détaillée de photo où il ressembleQuelle structure de vue est utilisée dans l'application Google Plus Android pour le défilement des photos et des commentaires?

tous défilement
Google+ header 
--------- 
Photo 
transparent background meta data (user, description, etc) 
comments 
--------- 
Add comment text input that is always on screen bottom 

Les données méta fond photo, transparents et commentaires tandis que l'entrée de texte Ajouter un commentaire reste fixe au bas de l'écran.  
S'agit-il simplement d'un ListView avec un zoom spécial ImageView dont la taille de la photo est définie lors de l'exécution?

Répondre

3

Ceci est fait avec un RelativeLayout. À l'intérieur d'un RelativeLayout vous pouvez placer vos vues où vous voulez. Dans ce cas, vous collez l'en-tête Google Plus sur le haut des parents et la barre de commentaire sur le bas du parent. Entre ces deux vues, vous mettez un ScrollView, qui contient l'image, les méta tags et les commentaires sur la photo.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<TextView 
    android:id="@+id/actionbar" 
    android:layout_width="fill_parent" 
    android:layout_height="50dp" 
    android:layout_alignParentTop="true" 
    android:textSize="20dp" 
    android:text="Google Plus ActionBar" /> 
<TextView 
    android:id="@+id/commentbar" 
    android:layout_width="fill_parent" 
    android:layout_height="50dp" 
    android:layout_alignParentBottom="true" 
    android:textSize="20dp" 
    android:text="Add Comment Bar" /> 
<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/actionbar" 
    android:layout_above="@id/commentbar"> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <FrameLayout 
      android:layout_width="fill_parent" 
      android:layout_height="500dp" 
      android:background="#00ff00" /> 
     <FrameLayout 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:background="#0000ff" /> 
     <FrameLayout 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:background="#ff0000" /> 
    </LinearLayout> 
</ScrollView> 

résultat

(vue vert devrait représenter l'image, le bleu et la vue rouge les commentaires): enter image description here

Questions connexes