I am developing an android game and in a kind of lobby screen with rooms, i have all the content of the screen inside a giant scroll. Here´s an image of it: http://postimg.org/image/s64pzkxkz/
The problem is: Even though i put a android:paddingBottom="40sp" on the ListView(to make it a little higher than the bottom of the giant scroll), the scrollbar associated with it is overlapping the giant scroll. There´s a giant gray line that touches the bottom of the scroll... That´s my scrollbar.
Here is the code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/idqualquersotestarlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@drawable/background_popups_modo_casual" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tituloCasual"
android:background="@drawable/plaquinha_treinamento"
android:layout_centerHorizontal="true"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:singleLine="true"
android:layout_marginTop="20sp"
android:text="@string/modo_casual"
android:id="@+id/textoTituloCasual"/>
</LinearLayout>
<ImageView
android:id="@+id/cordasPlacaCasual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tituloCasual"
android:layout_centerHorizontal="true"
android:src="@drawable/cordas_placa_treinamento"
android:layout_marginTop="-5sp" />
<RelativeLayout
android:id="@+id/pergaminho"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cordasPlacaCasual"
android:layout_marginTop="-60sp"
android:background="@drawable/pergaminho" >
<Button
android:id="@+id/botaoReload"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/botaoCriarNovaSala"
android:layout_toRightOf="@+id/botaoCriarNovaSala"
android:text="@string/recarregar"
android:onClick="recarregarSalas" />
<RelativeLayout
android:id="@+id/spinnerELabelPesquisarSalas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="110sp"
android:layout_centerHorizontal="true" >
<TextView
android:id="@+id/labelPesquisarSalas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="28dp"
android:text="@string/pesquisar_salas_por"
android:layout_centerVertical="true"
android:textSize="20sp"/>
<Spinner
android:id="@+id/spinnerPesquisarSalasModoCasual"
android:layout_width="200sp"
android:layout_height="50sp"
android:layout_toRightOf="@id/labelPesquisarSalas"
android:layout_alignTop="@+id/labelPesquisarSalas"/>
</RelativeLayout>
<TextView android:id="@+id/alerta_salas_novas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/alerta_novas_salas_criadas"
android:layout_below="@+id/botaoCriarNovaSala"
android:textSize="17sp"
android:layout_marginLeft="28dp"
android:layout_marginTop="30dp"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/cabecalho_tabela_listar_salas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alerta_salas_novas"
android:layout_marginTop="5dp"
android:background="@drawable/red_header"
android:layout_alignLeft="@+id/lista_salas_abertas"
android:layout_alignRight="@+id/lista_salas_abertas" >
<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_titulo_username"
android:layout_width="0px"
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:text="@string/email"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/label_categorias_selecionadas"
android:layout_width="0px"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/categorias"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/label_entrar_na_sala"
android:layout_width="0px"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text=""
android:textColor="#FFFFFF" />
</LinearLayout>
<ListView
android:id="@+id/lista_salas_abertas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/spinnerELabelPesquisarSalas"
android:layout_alignLeft="@+id/spinnerELabelPesquisarSalas"
android:layout_alignParentBottom="true"
android:paddingBottom="40sp"
android:layout_below="@+id/cabecalho_tabela_listar_salas"
android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true"
android:scrollbarStyle="insideInset"
android:listSelector="@android:color/transparent" >
</ListView>
<Button
android:id="@+id/botaoCriarNovaSala"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/spinnerELabelPesquisarSalas"
android:layout_centerHorizontal="true"
android:onClick="abrirTelaCriarNovaSala"
android:text="@string/criar_nova_sala" />
</RelativeLayout>
What can i do to add padding to the scrollbar?
The height of a ListView is the sum of the heights of it children. So a padding will have no effect on the list. In case you need a margin, you can use marginBottom.
But if you need a space inside the list, you will have to add it to the last child of the list. son in the getView method of the listView adapter you need to add something like this:
public View getView(int position, View convertView, ViewGroup parent) {
.
.
.
if(position == getCount() - 1){
view.setPadding(0, 0, 0, 40);
}
return view;
}