C# 调试时,控件显示在设计器视图中,但某些控件未显示在android设备中?
我是xamarin.android新手,我创建了一个空白的android应用程序,并在activity_main.xml中添加了两个按钮和一个图像视图,在我的android设备(Redmi 5A)上调试时,只显示图像视图,不显示按钮 Main.xmlC# 调试时,控件显示在设计器视图中,但某些控件未显示在android设备中?,c#,android,android-layout,android-activity,xamarin.android,C#,Android,Android Layout,Android Activity,Xamarin.android,我是xamarin.android新手,我创建了一个空白的android应用程序,并在activity_main.xml中添加了两个按钮和一个图像视图,在我的android设备(Redmi 5A)上调试时,只显示图像视图,不显示按钮 Main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schem
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:id="@+id/imageView1" />
<Button
android:text="Capture Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_toLeftOf="@id/imageView1"
android:layout_below="@+id/imageView1"
android:id="@+id/button1" />
<Button
android:text="Upload Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/imageView1"
android:layout_below="@+id/button1"
android:id="@+id/button2" />
我试过:
清洗和重建溶液。
选中SetContentView(Resource.Layout.Main);没有注释
但这些似乎都不适合我
有什么问题吗?您的布局有两个按钮的问题,您可以像blow一样尝试:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:id="@+id/imageView1" />
<Button
android:text="Capture Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_below="@+id/imageView1"
android:id="@+id/button1" />
<Button
android:text="Upload Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:id="@+id/button2" />
我已经删除了android:layout\u toLeftOf=“@id/imageView1”谢谢我假设问题出在我的布局上,谢谢alot@AsadUllah如果您已解决此问题,请单击✔代码>位于该答案的左上角。它将帮助其他有类似问题的人。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:id="@+id/imageView1" />
<Button
android:text="Capture Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_below="@+id/imageView1"
android:id="@+id/button1" />
<Button
android:text="Upload Image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:id="@+id/button2" />