How to set RecyclerView Max Height

前端 未结 12 1625
陌清茗
陌清茗 2020-12-01 15:55

I want to set Max Height of RecylerView.I am able to set max height using below code.Below code makes height 60% of current screen.

     DisplayMetrics displ         


        
12条回答
  •  自闭症患者
    2020-12-01 16:30

    You can just set a specific height to any value in the xml code and set the visibility to gone. Then you set the visibility to Visible in Java, when you want to inflate it. Here is an example;

    .xml

    android:visibility="gone"
    

    .java

    recyclerView.setVisibility(View.VISIBLE);
    

提交回复
热议问题