comment pouvons-nous faire de disposition de table pour faire défiler les deux sens ( horizontal, vertical)
Je vais avoir une table est définie dans le fichier XML, qui est actuellement fixé pour faire Défiler verticalement. Mais je veux aussi qu'il défilement horizontal comme requis.
Voici le code XML à utiliser
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:scrollbars="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1,2"
android:id="@+id/tLayout"
android:scrollbars="vertical"
>
<TableRow
android:layout_width="fill_parent">
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Name"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Address"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Age"
/>
</TableRow>
</TableLayout>
</ScrollView>
OriginalL'auteur Amit | 2010-03-02
Vous devez vous connecter pour publier un commentaire.
J'ai eu le même problème et je l'ai résolu en introduisant une HorizontalScrollView comme un enfant de la ScrollView et puis le tableLayout comme un enfant de la HorizontalScrollView:
OriginalL'auteur Nemesis
Vous pouvez consulter cette bibliothèque que j'ai fait: https://github.com/InQBarna/TableFixHeaders
Il Implémente une table qui peut être rempli par l'intermédiaire d'un Adapeter. Il recycle aussi les points de vue.
OriginalL'auteur Brais Gabin
Ne HorizontalScrollView n'importe quoi pour vous?
http://developer.android.com/reference/android/widget/HorizontalScrollView.html
Peut-être ajouter un peu de type de mise en page (LinearLayout, Relativelayout, etc.) à la racine de votre fichier xml?
OriginalL'auteur edwardsharp