안녕하세요~
아래와 같은 함수에 close.png 라는 이미지를 버튼으로 만들었습니다.
그런데 문제는 이게 화면 좌측 상단에 나와서 클릭을 하면 x버튼 처럼 화면이 꺼지고 제대로 동작이 되는데
꼭 좌측 상단이 아니라 우측상단, 아니면 제가 원하는 x,y 값에 해당 이미지를 세팅하고 싶은데요.
이 방법을 아시는 분은 꼭좀 답변 부탁드립니다.
그럼 즐거운 하루 되세요!
private void buildCloseButton()
{
// webview 에 추가로 x 버튼 삽입
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
String uri = "drawable/close";
int imageResource = getResources().getIdentifier(uri, null, getPackageName());
ImageButton closeButton = new ImageButton(this);
Drawable image = getResources().getDrawable(imageResource);
closeButton.setImageDrawable(image);
closeButton.setBackgroundColor(0);
lp2 = new LinearLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lp2.weight = 50;
lp2.gravity = Gravity.CENTER_VERTICAL;
orview.addView(closeButton, lp2);




orview 이 레이아웃을 RelativeLayout으로 만드시고 alignParentRight 값 주시면될듯