1
main.xml에 ImageButton을 만듭니다. 그리고 크기를 조절하고보기에서 ImageButton의 위치를 수정하고 싶습니다.ImageButton의 위치를 동적으로 조정하고 크기를 조정하는 방법은 무엇입니까?
main.xml에
<ImageButton
android:id="@+id/BtnExplore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_320x240_explorer"
android:background="@android:color/transparent"
/>
내가 크기 설정합니다 - iwidth 및 iheight 사용자가 버튼을 클릭하면 - 다음 및 이전을.
다음 버튼을 누릅니다.
iHeight++;
iWidth++;
BtnExplore.setMaxHeight(iHeight);
BtnExplore.setMaxWidth(iWidth);
BtnExplore.invalidate();
BtnExplore.postInvalidate();
이전 버튼을 누릅니다.
iHeight--;
iWidth--;
BtnExplore.setMaxHeight(iHeight);
BtnExplore.setMaxWidth(iWidth);
BtnExplore.invalidate();
여전히 이미지 버튼의 크기를 조정할 수 없습니다. 위치를 변경하는 방법도 필요합니다.
다음은 전체 코드입니다. 사용 setMinimumHeight
http://dl.dropbox.com/u/2452511/AndroidAP/IconClickTest-stackoverflow.tar.gz
내가 테스트 한 후 실행할 수 없습니다. 문제가있는 곳을 잘 모르겠습니다. setMinimumHeight 또는 무효화 함수에 문제가 있습니까? – ccchun