Set the size of the title of the browse list programmatically

I have a ListView with a title, and I need to set the title size programmatically depending on the screen size. Thus, it fills almost the entire screen. How can i do this? I found a way to get the height of the screen, but this is the full height of the display containing the height of the status bar of the phone.

+4
source share
1 answer

if you customize the title in a ListView by inflating the layout, for example:

ListView lv = getListView(); LayoutInflater inflater = getLayoutInflater(); ViewGroup header = (ViewGroup)inflater.inflate(R.layout.header, lv, false); lv.addHeaderView(header, null, false); 

you can change the height of the R.layout.header layout using

 header.setLayoutParams(params); 

You can get the height of the notification or status bar using this code here:

The height of the status bar?

+6
source

Source: https://habr.com/ru/post/1433535/


All Articles