RadioGroup与textview对不齐 android:layout_height="match_parent"
scrollview套listview问题:贴代码
static class Utility {
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
// pre-condition
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
}
在setAdapter之后调用此方法
onscroll定位问题
scrollview.smoothScrollTo(0,20);
fragment问题:
extends Fragment
拿组件的话通过view就行了,其它的好像跟activity没有什么区别
view = inflater.inflate(R.layout.fragment_main_interface, container, false);
view.findViewById(R.id.xxx);