두 개의 버튼 행을 포함하는 XML 파일이 있습니다. 한 행은 맨 위에 있고 다른 행은 맨 아래에 있습니다. 단추 두 줄 사이에는 뷰 클래스의 캔버스가 있습니다.앞에 버튼을 가져 오기
그러나 프로그램이 실행 중일 때는 맨 아래 줄 버튼이 나타나지 않습니다. 그것은 캔버스로 덮여있는 것 같습니다. 캔버스의 맨 아래에있는 버튼 행을 가져 오려면 어떻게해야합니까? 또는 캔버스의 높이를 어떻게 제한 할 수 있습니까?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/addbutton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Add"
android:textSize="9dip" />
<Button
android:id="@+id/deletebutton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/addbutton"
android:text="Delete"
android:textSize="9dip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<Button
android:id="@+id/nextbutton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next"
android:textSize="9dip" />
<Button
android:id="@+id/savebutton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:textSize="9dip" />
</LinearLayout>
</RelativeLayout>
내 MainActivity 코드 :
public class MainActivity extends Activity {
RelativeLayout layout;
static String equation, eqn;
public static StartDraw sd; //view class
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sd = new StartDraw(this);
final RelativeLayout layout = (RelativeLayout) findViewById(R.id.relativeLayout);
final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT);
lp.addRule(RelativeLayout.BELOW, R.id.addbutton);
sd.setLayoutParams(lp);
mainLayout.addView(sd);
addbutton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
}
});
}