안드로이드 개발 질문/답변
(글 수 45,052)
public void resizeParentLayoutHeight1(final Adapter adapter) {
listCount = adapter.getCount();
Log.i("listCount",""+listCount);
// Button button = (Button)mTestLayout.findViewById(R.id.btnFooter);
// button.setOnClickListener(new OnClickListener(){
// public void onClick(View v){
// Toast.makeText(thing.this, "쪼금온듯??",Toast.LENGTH_SHORT).show();
//
// }
// });
if (adapter != null) {
if (listCount > 0) {
double height = (MAX_LISTVIEW_ROW_HEIGHT * listCount);
Log.i("height", ""+height);
resizeParentLayoutHeight(height);
lv.post(new Runnable() {
public void run() {
int height = lv.getMeasuredHeight();
Log.i("tag", ""+height);
if (height > 0) {
resizeParentLayoutHeight(height);
}
}
});
}
};
}
private void resizeParentLayoutHeight(double height) {
final RelativeLayout layout = (RelativeLayout)findViewById(R.id.listViewLayout);
if (layout != null) {
final ViewGroup.LayoutParams params = layout.getLayoutParams();
if (params != null) {
if (lv != null) {
// MarginLayoutParams margin = (MarginLayoutParams)lv.getLayoutParams();
//
// if(margin != null) {
// height += (margin.topMargin + margin.bottomMargin);
// }
}
params.height = (int)height;
runOnUiThread(new Runnable() {
public void run() {
layout.setLayoutParams(params);
}
});
}
}
}
스크롤 안에 리스트뷰를 써야할일이 있어서 이 소스를 쓰고있는데요...
스크롤 안에 리스트뷰를 넣는거는 성공했는데..
이게 리스트뷰의 숫자에따라 밑에 길이가 늘어납니다..;;
뭔가..마진이 생기는거같거든요..ㅠㅠ 화면 아래와 리스트뷰 끝의 빈공간이생긴다는겁니다...
많으면은 많을수록 자꾸 늘어나는데요...그래서 보기가 굉장히안좋은데..;;
방법이없나요??