2016-12-31 21 views
0

私は何が問題なのかを考えてみました。 私は音楽プレーヤーを作成しようと、次のAMはAndroidのボタンが電話に表示されていません

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@drawable/img_btn_playlist_pressed" 
    android:id="@+id/list" 
    android:background="@null"/> 

<TextView 
    android:text="Select a song to play" 
    android:typeface="serif" 
    android:textStyle="bold" 
    android:textSize="30dp" 
    android:textColor="#FFFFFF" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginStart="13dp" 
    android:layout_marginTop="94dp" 
    android:id="@+id/text" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentStart="true" 
    android:layout_row="0" 
    android:layout_column="1" /> 

<SeekBar 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="51dp" 
    android:id="@+id/seekBar" 
    android:layout_alignEnd="@+id/forward" 
    android:layout_alignStart="@+id/text" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@drawable/img_btn_previous_pressed" 
    android:layout_marginStart="24dp" 
    android:id="@+id/backward" 
    android:background="@null" 
    android:layout_alignTop="@+id/forward" 
    android:layout_alignStart="@+id/seekBar" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@drawable/img_btn_play" 
    android:id="@+id/play" 
    android:layout_row="21" 
    android:layout_column="1" 
    android:background="@null" 
    android:layout_marginBottom="42dp" 
    android:layout_above="@+id/seekBar" 
    android:layout_toEndOf="@+id/backward" 
    android:layout_marginStart="25dp" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@drawable/img_btn_forward_pressed" 
    android:layout_marginTop="14dp" 
    android:id="@+id/forward" 
    android:background="@null" 
    android:layout_alignTop="@+id/play" 
    android:layout_alignEnd="@+id/text" 
    android:layout_marginEnd="26dp" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@drawable/img_btn_repeat" 
    android:id="@+id/repeat" 
    android:background="@null" 
    android:layout_alignBottom="@+id/forward" 
    android:layout_toEndOf="@+id/text" 
    android:layout_marginStart="8dp" /> 

私のXMLファイルであり、これはAndroidのスタジオで上記レイアウトのスクリーンショットです。

Screenshot

の問題は、私は自分の携帯電話上で同じことを実行しようとすると、ボタンのどれもが携帯電話上に表示されていない、あるだけTextViewとシークバーが見え、残りnoneです。何が問題なの? Androidスタジオでボタンが正常に見えてもボタンが表示されない理由...

PS:ここではRelativeLayoutを使用しています。 ご協力いただければ幸いです。 :)

+2

削除アンドロイドの下に使用し動作しない場合:お使いの携帯電話とどのようなあなたのAndroidのバージョン が何であるかを –

+0

すべてから背景=「@ヌル」あなたの携帯電話の言語は何ですか アンドロイドのrtlサポート のために アンドロイド:supportsRtl = "false"を追加してこのサポートをキャンセルしようとしました。 fests.xml –

+0

@MohamedFadhl私はそれを試みました、それは仕事をしませんでした... –

答えて

0

以下のコードを使用してください。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity"> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/img_btn_playlist_pressed" 
     android:id="@+id/list"/> 

    <TextView 
     android:text="Select a song to play" 
     android:typeface="serif" 
     android:textStyle="bold" 
     android:textSize="30dp" 
     android:textColor="#FFFFFF" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginStart="13dp" 
     android:layout_marginTop="94dp" 
     android:id="@+id/text" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentStart="true" 
     android:layout_row="0" 
     android:layout_column="1" /> 

    <SeekBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_marginBottom="51dp" 
     android:id="@+id/seekBar" 
     android:layout_alignEnd="@+id/forward" 
     android:layout_alignStart="@+id/text" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/img_btn_previous_pressed" 
     android:layout_marginStart="24dp" 
     android:id="@+id/backward" 
     android:layout_alignTop="@+id/forward" 
     android:layout_alignStart="@+id/seekBar" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/img_btn_play" 
     android:id="@+id/play" 
     android:layout_row="21" 
     android:layout_column="1" 
     android:layout_marginBottom="42dp" 
     android:layout_above="@+id/seekBar" 
     android:layout_toEndOf="@+id/backward" 
     android:layout_marginStart="25dp" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/img_btn_forward_pressed" 
     android:layout_marginTop="14dp" 
     android:id="@+id/forward" 
     android:layout_alignTop="@+id/play" 
     android:layout_alignEnd="@+id/text" 
     android:layout_marginEnd="26dp" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/img_btn_repeat" 
     android:id="@+id/repeat" 
     android:layout_alignBottom="@+id/forward" 
     android:layout_toEndOf="@+id/text" 
     android:layout_marginStart="8dp" /> 


</RelativeLayout> 

それでもそれは、コード

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity"> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/img_btn_playlist_pressed" 
     android:id="@+id/list"/> 

    <TextView 
     android:text="Select a song to play" 
     android:typeface="serif" 
     android:textStyle="bold" 
     android:textSize="30dp" 
     android:textColor="#FFFFFF" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginStart="13dp" 
     android:layout_marginTop="94dp" 
     android:id="@+id/text" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentStart="true" 
     android:layout_row="0" 
     android:layout_column="1" /> 

    <SeekBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_marginBottom="51dp" 
     android:id="@+id/seekBar" 
     android:layout_alignEnd="@+id/forward" 
     android:layout_alignStart="@+id/text" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/img_btn_previous_pressed" 
     android:layout_marginStart="24dp" 
     android:id="@+id/backward" 
     android:layout_alignTop="@+id/forward" 
     android:layout_alignStart="@+id/seekBar" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/img_btn_play" 
     android:id="@+id/play" 
     android:layout_row="21" 
     android:layout_column="1" 
     android:layout_marginBottom="42dp" 
     android:layout_above="@+id/seekBar" 
     android:layout_toEndOf="@+id/backward" 
     android:layout_marginStart="25dp" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/img_btn_forward_pressed" 
     android:layout_marginTop="14dp" 
     android:id="@+id/forward" 
     android:layout_alignTop="@+id/play" 
     android:layout_alignEnd="@+id/text" 
     android:layout_marginEnd="26dp" /> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/img_btn_repeat" 
     android:id="@+id/repeat" 
     android:layout_alignBottom="@+id/forward" 
     android:layout_toEndOf="@+id/text" 
     android:layout_marginStart="8dp" /> 


</RelativeLayout> 
関連する問題