按钮在模拟器的 ListView 上不可见,但在渲染器上可见
Button not visible on ListView in emulator though it is visible on the Renderer
这是我在列表视图布局中的代码xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@android:id/empty"
android:text="No schedules available"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TextView>
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:layout_gravity="right|bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="89dp"
android:layout_height="56dp"
android:id="@+id/add_schedule"
android:layout_gravity="right"
android:src="@mipmap/ic_add_fab"
android:background="#00ffffff"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
该按钮在渲染器中可见,但在我的模拟器中不可见。建议会很有帮助
整个设置在主细节流程中
首先,您的按钮在模拟器中显示,但您看不到它,因为它可能隐藏在 ListView 下。
你会说:
"My ListView
is in the left bottom corner of RelativeLayout
".
部分你是对的,但你看 - 你将宽度设置为 match_parent
。将此属性更改为 30dp
,我相信您会看到您的按钮。
按照其他人的建议尝试 Floating Action Button
(FAB
)。这是一个很好的教程,如何正确使用它:https://guides.codepath.com/android/floating-action-buttons
如果您不喜欢它的标准实现,请查看此页面:
https://android-arsenal.com/tag/173
希望对您有所帮助
这是我在列表视图布局中的代码xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@android:id/empty"
android:text="No schedules available"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TextView>
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:layout_gravity="right|bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="89dp"
android:layout_height="56dp"
android:id="@+id/add_schedule"
android:layout_gravity="right"
android:src="@mipmap/ic_add_fab"
android:background="#00ffffff"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
该按钮在渲染器中可见,但在我的模拟器中不可见。建议会很有帮助 整个设置在主细节流程中
首先,您的按钮在模拟器中显示,但您看不到它,因为它可能隐藏在 ListView 下。
你会说:
"My
ListView
is in the left bottom corner ofRelativeLayout
".
部分你是对的,但你看 - 你将宽度设置为 match_parent
。将此属性更改为 30dp
,我相信您会看到您的按钮。
按照其他人的建议尝试 Floating Action Button
(FAB
)。这是一个很好的教程,如何正确使用它:https://guides.codepath.com/android/floating-action-buttons
如果您不喜欢它的标准实现,请查看此页面: https://android-arsenal.com/tag/173
希望对您有所帮助