在XML设计上我添加了两个按钮,其中一个按钮的工作没有任何问题,但第二个按钮在设备上不可见。 (这两个按钮保留在XML中的ListView中)。如果有人能帮助我理解为什么会发生这种情况,我会很高兴,我能否解决它。谢谢。Android按钮在设备上不可见
XML(设置按钮的问题是按钮) -
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="gg.gg.MainActivity">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Tasks"
android:background="#e2e2e2" />
<ListView
android:id="@+id/list_todo"
tools:listitem="@layout/item_todo"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/settings"
android:background="@drawable/settings"
android:onClick="ButtonClick"
android:id="@+id/settings"
android:layout_above="@+id/add_task"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/add_task"
android:src="@drawable/addtask"
android:background="@drawable/addtask"
android:layout_alignParentBottom="true"
android:layout_alignEnd="@+id/settings" />
</RelativeLayout>
试着给你的代码的元素提供所需的权重。 –
我把你的XML粘贴到一个虚拟项目中(假设你没有在绘图中做任何奇怪的事情),它们都显示在彼此之上。你在看什么版本的Android? –
@ChrisWard API 22 – proli2