Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Space between ActionBar and ListView Rows

I have a ListView in a LinearLayout. I want to have space between actionbar and my first item of listview like YouTube App: enter image description here

to getting this result, I've tried padding and margin in order for LinearLayout and ListView, but when user scroll ListView, items should goes beyond of Actionbar BUT!! as you can see in my result image, items start disappearing by space from top edge! ( space is my padding or margin that was set for listview or linearlayout )

Is anybody there that know how can handle this issue?

Thanks

like image 254
MAY3AM Avatar asked Dec 14 '25 01:12

MAY3AM


1 Answers

all you need to do is add a textview to the xml above the listview. Should look like something below:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.90" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="422dp" />

</LinearLayout>
like image 166
Michele La Ferla Avatar answered Dec 15 '25 17:12

Michele La Ferla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!