Android的ListView控件在滚动条与头对齐 [英] Android ListView with Scrollbar aligned with header
问题描述
我有以下的code为我的列表视图与包头:LinearLayout中包含我的所有头,剩下的就是我的列表视图:
I have the following code for my listview with a header: The LinearLayout contains all my header and the rest is my listview:
<LinearLayout android:id="@+id/cabecalho_tabela_listar_salas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:orientation="horizontal"
android:background="@drawable/red_header"
android:layout_below="@+id/botaoCriarNovaSala" >
<TextView
android:id="@+id/label_titulo_username"
android:layout_width="0px"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:text="@string/email"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/label_titulo_do_jogador"
android:layout_width="0px"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:text="@string/dan"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/label_categorias_selecionadas"
android:layout_width="0px"
android:layout_weight="2"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/categorias"
android:textColor="#FFFFFF" />
</LinearLayout>
<ListView
android:id="@+id/lista_salas_abertas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/cabecalho_tabela_listar_salas"
android:layout_alignRight="@+id/cabecalho_tabela_listar_salas"
android:layout_alignParentBottom="true"
android:layout_below="@+id/cabecalho_tabela_listar_salas"
android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true"
android:scrollbarStyle="outsideInset" >
</ListView>
的问题是:头与ListView的滚动,而不仅仅是列表视图对齐。
有关详细说明,这里是在Facebook上我的code图片:<一href=\"https://www.facebook.com/media/set/?set=a.10204710735749682.1073741826.1275205806&type=1&l=1985f5f7d8\" rel=\"nofollow\">https://www.facebook.com/media/set/?set=a.10204710735749682.1073741826.1275205806&type=1&l=1985f5f7d8
左图是我。正确的是我想要的。注意标题。我想报头与刚列表视图对齐,而不是滚动条也。
The left picture is what i have. The right one is what i want. Pay attention to the header. I want the header to be aligned with just the listview, not the scrollbar also.
我应该做些什么?
推荐答案
尝试设置以下到您的的ListView
:
android:scrollbarStyle="outsideOverlay"
如果根据需要再与可用其他选项尝试它不工作的 这里 。
If it doesn't work as desired then try with the other options as available here.
这篇关于Android的ListView控件在滚动条与头对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!