Java Code Examples for android.widget.ListView.measure()

The following are Jave code examples for showing how to use measure() of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: yjPlay   File: BelowView.java   Source Code and License Vote up 5 votes
/**
 * Instantiates a new Below view.
 *
 * @param c        the c
 * @param listName the list name
 */
public BelowView(@NonNull Context c, @Nullable List<String> listName) {
    this.convertView = View.inflate(c, R.layout.simple_exo_belowview, null);
    listView = (ListView) convertView.findViewById(R.id.list_item);
    if (listName == null) {
        listName = Arrays.asList(c.getResources().getStringArray(R.array.exo_video_switch_text));
    }
    adapter = new SwitchAdapter(c, listName);
   listView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    listView.setAdapter(adapter);
}
 
Example 2
Project: XiaoTianQi   File: ChooseAreaActivity.java   Source Code and License Vote up 5 votes
private void initView() {
    titleView = (TextView) findViewById(R.id.title_text);
    listView = (ListView) findViewById(R.id.list_view);

    //测量listView的尺寸
    listView.measure(0,0);
    mListViewHeight = listView.getMeasuredHeight();
    mListViewWidth = listView.getMeasuredWidth();
}