내 애플리케이션에 버튼이 있습니다. 프로그래밍 방식으로 위치를 변경하고 싶습니다. 다음과 같이 내가 XML에서 버튼을 만들었습니다Android 버튼 위치 프로그래밍 방식으로
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50px"
android:layout_marginTop="10px"
>
</Button>
</LinearLayout>
은 가정하자 내가 (layout_marginLeft로 = "100 픽셀") 왼쪽에서 100 픽셀로 버튼의 위치를 설정합니다. 프로그래밍 방식으로 어떻게 할 수 있습니까? 문제 해결을 도와주세요.
사실 내 레이아웃 9 개 버튼이 있습니다 ... 그래서 일부 버튼이 condition..so에 따라 볼 수 있고 보이지 않는 내가 정렬 할 날이 점에 오게 사용 (왼쪽 또는 오른쪽으로 이동) 프로그래밍 방식으로 ... pls help –
이 대답을 살펴보십시오. 버튼에 여백을 설정하는 방법을 명확하게 보여줍니다. http://stackoverflow.com/a/4594374/525541 – MindWire