Posts

Showing posts with the label set width of linear in Custom ListView

Codes to improve firebase chatting app in sketchware

Image
Here are a few codes which can be used in the chat application created using Firebase in Sketchware. 1. Remove divider​ height of ListView To remove the divider height of ListView displaying messages, put following code in onCreate , in an add source directly block. listview1.setDivider(null); listview1.setDividerHeight(0); 2. Display end of ListView on refresh To make the ListView scroll to display the last element of list when updated, put following code in onCreate , in an add source directly block. listview1.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); listview1.setStackFromBottom(true); 3. Set width of ListView items to 3/4 of screen width Firstly, in CustomView , insert a LinearH linear1, and inside that insert a LinearV linear2. Put all contents to be displayed in linear2. Now, in event onBindCustomView , add a number variable width. Set width to getDisplayWidthPixels * 0.75, and set it as width of linear2 using following code. LinearLayout.Layou