D
D
Denis Karakchiev2015-08-30 16:34:13
Android
Denis Karakchiev, 2015-08-30 16:34:13

The button is not displayed when testing the application, how to fix it?

The Activity has a button. When starting the emulator - no. The Buttons work, but the ones that don't are the ImageButtons, although they were also displayed a few moments ago. All I changed was to stretch them out a bit in the GUI.
Here is the activity text:

<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" 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=".QuizActivity">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="24dp"
        android:id="@+id/question_text_view"
        android:layout_above="@+id/linearLayout"
        android:layout_centerHorizontal="true" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/linearLayout"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true">


        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/false_button"
            android:id="@+id/falseButtonId"/>

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/true_button"
            android:id="@+id/trueButtonId" />
    </LinearLayout>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/next_button"
        android:src="@drawable/arrow_right"
        android:layout_below="@+id/linearLayout"
        android:layout_alignEnd="@+id/linearLayout"
        android:layout_toEndOf="@+id/question_text_view"
        android:cropToPadding="false" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/prevButton"
        android:src="@drawable/arrow_left"
        android:layout_below="@+id/linearLayout"
        android:layout_alignStart="@+id/linearLayout"
        android:layout_toStartOf="@+id/question_text_view" />

</RelativeLayout>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tiberal, 2015-08-31
@Tiberal

What is the minimum supported sdk version? For ImageButton you are using attributes that are only available from version 17

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question