2016-08-20 3 views
0

У меня есть некоторые проблемы с расположением меток, я не показывал buttonBar, хотя он находится в коде xml. Пожалуйста, решите мою проблему.Размещение макета элементов, не показаны buttonBar

Это мой код:

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageQuote" 
    android:layout_marginTop="10dp" 
    android:layout_centerHorizontal="true" /> 


<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:text="Description" 
    android:id="@+id/descriptionOfQuote" 
    android:layout_below="@+id/imageQuote" 
    android:layout_marginTop="10dp" 
    android:layout_centerHorizontal="true" 
    android:foregroundGravity="center" 
    android:textSize="22dp"/> 

<LinearLayout 
    android:id="@+id/buttonBar" 
    android:layout_marginBottom="1dp" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:foregroundGravity="center" 
    android:gravity="bottom" 
    > 
    <ImageButton 
     android:layout_width="85dp" 
     android:layout_height="match_parent" 
     android:id="@+id/arrow_left" 
     android:src="@drawable/arrow_left" 
     android:background="?android:selectableItemBackground"/> 
    <ImageButton 
     android:layout_width="85dp" 
     android:layout_height="match_parent" 
     android:id="@+id/btn_copy" 
     android:src="@drawable/copy" 
     android:background="?android:selectableItemBackground"/> 

    <ImageButton 
     android:layout_width="85dp" 
     android:layout_height="match_parent" 
     android:id="@+id/btn_share" 
     android:src="@drawable/share" 
     android:background="?android:selectableItemBackground"/> 

    <ImageButton 
     android:layout_width="85dp" 
     android:layout_height="match_parent" 
     android:id="@+id/arrow_right" 
     android:src="@drawable/arrow_right" 
     android:background="?android:selectableItemBackground"/> 

</LinearLayout> 

enter image description here

Как сделать, чтобы ButtonBar был в нижней части экрана?

+0

Чего вы хотите достичь, точно? Вы говорите, что вам не нужны две кнопки? –

+0

Я хочу buttonBar был внизу. В моем коде есть, но экрана нет. –

ответ

0

У меня есть две подсказки, которые могут решить вашу проблему:

1) делает LinearLayout горизонтальной ориентации:

<LinearLayout 
android:id="@+id/buttonBar" 
android:layout_marginBottom="1dp" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentBottom="true" 
android:foregroundGravity="center" 
android:gravity="bottom" 
android:orientation="horizontal" 
> 

2) Я не уверен, но может быть проблемой с высотой детей ButtonBar попробуйте установить его как ширина:

<ImageButton 
    android:layout_width="85dp" 
    android:layout_height="85dp" 
    android:id="@+id/arrow_left" 
    android:src="@drawable/arrow_left" 
    android:background="?android:selectableItemBackground"/> 

Я на самом деле не имеют Android Studio, чтобы проверить, если мой ответ правильный, жаль, что :(

+0

К сожалению, это решение мне не помогает. –

Смежные вопросы