我是Xamarin axml的新手,如该图所示,如何在屏幕下方放置图像按钮。
这是我当前的AXML代码
<?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">
<TextView
android:text = "@string/HelloXamarin"
android:textAppearance = "?android:attr/textAppearanceLarge"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:id = "@+id/textView1" />
<Button
android:id = "@+id/MyButton"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/ButtonClick" />
<Button
android:text="CALL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ButtonCall" />
</LinearLayout>
答案 0 :(得分:0)
执行此操作的最佳方法是改用RelativeLayout, 像这样:
<RelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<LinearLayout
android:orientation = "vertical"
android:layout_alignParentTop="true"
android:layout_width = "match_parent"
android:layout_height = "wrap_content">
<TextView
android:text = "@string/HelloXamarin"
android:textAppearance = "?android:attr/textAppearanceLarge"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:id = "@+id/textView1" />
<Button
android:id = "@+id/MyButton"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/ButtonClick" />
<Button
android:text="CALL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ButtonCall" />
</LinearLayout>
<ImageView
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_margin="5dp"
android:src="@drawable/imageName"
</RelativeLayout>