XMLデザインでは、2つのボタンを追加しますが、いずれかのボタンは問題なく動作しますが、デバイスの2番目のボタンは表示されません。 (ボタンの2つは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をダミープロジェクトに貼り付けました。(あなたがdrawableで奇妙なことをしないと仮定すると)、それらはお互いの上に現れます。これを表示しているAndroidのバージョンは何ですか? –
@ChrisWard API 22 – proli2