1

I'm new to Android programming and want to create my own piano app. I use absoluteLayout with dp - or is there a better way? I have buttons declared like this

   <Button
    android:id="@+id/d3"
    android:layout_width="55dp"
    android:layout_height="200dp"
    android:layout_x="55dp"
    android:background="@drawable/selector_button"
    android:scrollbars="horizontal"
    android:gravity="bottom|center_horizontal"
    android:paddingBottom="20dp"
    android:textSize="60dp"
    android:textColor="#ff4444" />

selector_button

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/white_pressed"
        android:state_pressed="true" />
    <item android:drawable="@drawable/key" />
</selector>

The problem is that the white key when pressed down draws over the black one here's a screenshot

I've tried the bringToFront-method on the black key, an the elevation option on it, but haven't been able to solve the problem. Do you have a hint?

Cœur
  • 37,241
  • 25
  • 195
  • 267
mbisping
  • 11
  • 1

0 Answers0