2

I am reading over the documentation for the Popup Menu. I have an ImageView in my xml layout:

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_overflow_holo_dark"
    android:contentDescription="@string/descr_overflow_button"
    android:onClick="showPopup" />

I am getting the error "Cannot Resolve Symbol '@drawable/ic_overflow_holo_dark'". In my res/drawable folder, there is no such icon named ic_overflow_holo_dark. Yet, it appears in the documentation. Is this graphic provided by Android? How can I get the Popup src icon?

This is what my app/build.gradle looks like:

android {
    compileSdkVersion 22
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "io.menuloop.menuloopandroid"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Daniel Viglione
  • 8,014
  • 9
  • 67
  • 101

1 Answers1

3

You need to add a drawable named ic_overflow_holo_dark in your drawable res folder. @drawable prefix specifies that it should look in your app resources. To specify android drawables, you need to use @android:drawable prefix.

tompee
  • 1,408
  • 1
  • 7
  • 6
  • So I am supposed to create my own ic_overflow_holo_dark icon? I am just looking for the three-dotted flyout menu that is already available in the ActionBar. But I want to add that icon to this ImageView. – Daniel Viglione May 26 '17 at 01:31
  • Yes. If you want a copy of the android drawable, you can check this out https://stackoverflow.com/a/17557247/8064335 – tompee May 26 '17 at 01:43
  • 1
    The fact that I can see the icon in the ActionBar, doesn't that suggest that the icon is already included in the SDK I am using? I am on Mac OSX. – Daniel Viglione May 26 '17 at 01:59
  • 5
    Yes you are right. The icon is already available in your SDK. This is also available as a vector drawable. Right click on your res folder, select New -> Vector Asset. Click the Icon button, select Navigation in the left pane and look for more vert. I am using Android Studio 2.3.2 with updated platform and support libraries. Hope this helps. – tompee May 26 '17 at 02:13
  • 1
    Your last comment was helpful. Interesting why Android Studio doesn't just make these icons available in the search path, so you don't have to go the process you described above. – Daniel Viglione May 26 '17 at 02:18
  • Also thanks for the distinction between @ android:drawable and @ drawable. Note that ic_overflow_holo_dark is not present in @ android:drawable either. – Daniel Viglione May 26 '17 at 20:27