Android Studio 드로어 블 폴더
Android Studio에서 앱 내에서 사용할 이미지를 어디에 둘지 알 수 없습니다. 드로어 블 폴더는 drawable-hdpi, drawable-ldpi 등으로 나뉘 지 않습니다. 또 다른 질문을 보았고 이에 대한 답변은 Android보기 대신 프로젝트보기로 전환하는 것이었지만 드로어 블은 폴더 하나뿐입니다. mipmap-hdpi, mipmap-ldpi 등이 있지만 사람들은 앱 아이콘에만 해당한다고 말합니다. 혼란 스럽습니다.
필요한 DPI에 대한 드로어 블 폴더가 표시되지 않으면 직접 만들 수 있습니다. 그것에 대해 마법 같은 것은 없습니다. 올바른 이름을 가져야하는 폴더 일뿐입니다.
실제로 탭에서 Android를 선택하여 프로젝트로 변경했습니다.
단계

그러면 모든 폴더를 찾을 수 있습니다.

다양한 이미지 밀도에 대한 드로어 블 디렉토리 구조를 만들려면 다음을 수행해야합니다.
\res폴더를 마우스 오른쪽 버튼으로 클릭하십시오.- 고르다
new >android resource directory 에서
New Resource Directory창에서Available qualifiers자원 유형 섹션을 선택합니다drawable.밀도를 추가하고 적절한 크기를 선택하십시오.
안드로이드 스튜디오에서는 조금 까다로워서 생성해야하는 모든 화면 크기에 대한 기본 폴더가 없지만 약간의 트릭이 있습니다.
- 드로어 블 폴더에 이미지를 붙여 넣으면 디렉토리에 대해 묻는 팝업이 나타납니다.
- drawable-xxhdpi와 같이 drawable 뒤에 하위 폴더 이름 추가
- 다른 크기에 대해 자동으로 감지 할 가장 높은 해상도로 이미지를 붙여 넣는 것이 좋습니다. 다음에 붙여 넣을 때 디렉토리에 대해 묻습니다.
여전히 문제가 있으면 여기에 이미지를 게시 할 수 없습니다. 여기 튜토리얼입니다 ..
Android Studio 1.2.1.1에서
Just copy the image and paste the image into the app > res > drawable folder and it will shows you "Choose Destination Directory" popup screen as shown below screen

Now you can select option whatever resolution you want to place and if you want to view the those image into the folders then simply right click on the drawable folder > select copy paths option and open it. It will help you.
There are two cases:
If you are having a single image, irrespective of device version, then you should put your images in drawable folder.
But for the images that you created separately for hdpi, ldpi, mdpi, xhdpi, xxhdpi and xxxhdpi, depending on screen resolution of the mobile that will be using the app, you have to puy them in drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi and drawable-xxxhdpi folders respectively.
For the first case, if there is a single image, you can pretty much place it in any drawable folder, but its standard convention to put them in drawable folder.
This tool creates the folders with the images in them automatically for you. All you have to do is supply your image then drag the generated folders to your res folder. http://romannurik.github.io/AndroidAssetStudio/
All the best.
Just to make complete all answers, 'drawable' is, literally, a drawable image, not a complete and ready set of pixels, as .png
즉, 드로어 블은 벡터 이미지 전용입니다. '드로어 블'을 마우스 오른쪽 버튼으로 클릭하고 새로 만들기> 벡터 자산으로 이동 하면 수락되지만 이미지 자산 은 추가되지 않습니다.
이미지를 생성하는 '그리기'데이터는 다음과 같은 XML 파일에 기록됩니다.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,
-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,
19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,
1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,
1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,
2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,
1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,
0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,
5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
</vector>
이것이 ic_android_black_24dp 의 코드입니다 .
참고 URL : https://stackoverflow.com/questions/28784593/android-studio-drawable-folders
'Nice programing' 카테고리의 다른 글
| 실용적인 HTTP 헤더 길이 제한이 있습니까? (0) | 2020.11.01 |
|---|---|
| @ Html.DisplayFor-DateFormat ( "mm / dd / yyyy") (0) | 2020.10.31 |
| Java 중요 섹션에서 무엇을 동기화해야합니까? (0) | 2020.10.31 |
| @로 매개 변수 이름 접두사 C # (0) | 2020.10.31 |
| Android의 WebView에서 JavaScript에서 반환 값을 얻는 방법은 무엇입니까? (0) | 2020.10.31 |