Button not showing up on screen

前端 未结 2 1852
不思量自难忘°
不思量自难忘° 2021-01-17 05:25

I have created an app where i showing listview with an image and text . I add Button in the end of page . But this is not showing on screen .I am new in android .How can i

相关标签:
2条回答
  • 2021-01-17 06:15

    Put into RelativeLayout parrent then set a static marginBottom that is equal to height of the button for listview and after that put the button in bottom of the parrent

    0 讨论(0)
  • 2021-01-17 06:21

    Set android:layout_height="0dip" and android:layout_weight="1" to ListView as below...

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/maps"
        android:orientation="vertical"
        android:padding="8dp"
        tools:context=".MainActivity" >
    
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/WAYLF"
            android:textSize="22sp" />
    
        <ListView
            android:id="@+id/list_view"
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:cacheColorHint="@android:color/transparent"
            android:dividerHeight="4dp" />
    
        <Button
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:layout_marginTop="25dp"
            android:background="@android:color/holo_green_light"
            android:text="@string/NEXT" />
    
    </LinearLayout>
    
    0 讨论(0)
提交回复
热议问题