본문 바로가기

전체 글

(23)
안드로이드 스튜디오 GridView Constraint Layout으로 구현하기 GridView에 대해 알기전 이미 구현하다가 ListView를 배우고 검색하다 GridView를 찾게되어서 더이상 사용하지 않지만 열심히 만들었기에 아까워서라도 올립니다..ㅎ 사용중인 레이아웃을 찾은 뒤 ConstraintLayout params를 만들고, 버튼을 만들어 줍니다. 버튼에 마진을 주려고 params에 margin값을 아무리 넣어도 안되더라구요. 그래서.. 위 처럼 마진값을 else -> if 안에 constraintSet.setMargin을 통해 넣어줍니다. constraintSet.connect 부분이 constraint layout xml에서 사용되는 start to start, top to top등을 연결해주는 부분과 동일합니다. 그래서 생성한 버튼의 id를 btn.getId()로 ..
안드로이드 스튜디오 Fragment에 코드로 버튼 생성하기 제목의 내용을 하려는데 한국어로 검색했을 때 나오는 정보로는 계속 context에 빨간 줄 들어오고, 안돼서 개고생하다 영어로 찾으니까 바로 나오네요. 정말 간단해요! 위 처럼 버튼을 만들 fragment.xml에서 android:id를 만들어 줍니다. 그리고 자바 코드 부분에서 layout을 root를 이용하여 찾아줍니다. 그 후 버튼을 생성할 때 context 부분을 getActivity()로 잡아주면 되겠습니다! 끄읕! 아 root 부분은 아래 사진 참고 해주세요.
안드로이드 스튜디오 에러 - checkdebugduplicateclasses failed 아무 문제없이 잘 되다가 새로 만들었더니 이런 에러가 뜨네요.. 검색 해보니 build.gradle:app에 뭐 추가해라 등등 하던데 전혀 안됐어요. 그래서 이전에 됐던 프로젝트의 build.gradle 가져와서 이름만 바꾸어 봤는데 잘 되길래 비교 해 봤더니.. 버전 차이가 위 와 같이 있었어요. 그래서 간단하게 숫자를 바꿔주고 위 사진의 Sync Now를 누른 후 실행하면 고쳐집니다! 저는 참고로 API 26, 27 (Oreo) 두 버전으로 돌렸을 때 이고, 둘 다 위처럼 바꾸면 문제 없이 돌아갑니다.
Unity Error without specific reason - it works but has red lines on visual studio files As you can see from the picture above, sometimes it happens like that. Usually, it happened after unzipping the zipped file and reopening the project. It's so simple to fix this problem. Turn off the project you have a problem with. Get into the project location and delete "TestDelegate.sln" file. Then, re-open the project from unity and double click on "delegateTest" file. And it fixes the prob..
A method as a parameter - how to use Delegate I was thinking about "would it be possible to use a method as a parameter?". And actually, it was possible in JS but in C# it didn't work to pass a method right away. So I found a way to do it in C# and it's called delegate. Let's give it a try passing a method as a parameter. As on the 8th line, declare a variable as a delegate. (delegateTestFunc) The important thing to remember when you declar..
유니티 알 수 없는 에러 꿀팁 - 실행은 되는데 유니티에 해당되는 부분 빨간줄 위처럼 빨간줄은 뜨는데 정작 유니티 실행에는 문제 없던 적 있나요? 보통 유니티 프로젝트를 압축한 뒤 다른 곳에서 열면 위와같은 현상이 일어나는데요. 해결 방법은 정말 간단합니다. 먼저 visual studio는 꺼줍니다. 해당 프로젝트 폴더에 들어가서 가장 아래의 TestDelegate.sln 파일을 삭제하고, 유니티에서 해당 스크립트를 찾은 뒤 더블클릭하면 새로 파일이 생깁니다. 그럼 문제는 해결 되죠!
유니티 함수 전달 - Delegate 사용법 유니티를 사용하다 문득 함수를 매개변수로 넣어줄 수 없을까? 싶어서 찾다가 Delegate를 찾았습니다. 자바스크립트에서는 그냥 함수를 매개변수로 넣을 수 있지만 C#에서는 안되더군요. 그래서 Delegate를 이용하여 C#에서 함수를 매개변수로 전달하는 법을 알아봅시다. 먼저 8번 줄에 delegate를 선언 합니다. (delegateTestFunc) delegate 선언시에 주의할 사항은 리턴값, 매개변수가 delegate에 넣을 함수와 같은 형태여야 합니다. 즉 위의 예시에서는 testFunc의 리턴값과 매개변수가 delegate 선언과 같은 형태로 쓰여진걸 볼 수 있습니다. delegate 선언이 끝났으면 delegate에 담을 함수 또한 같은형태로 만들어 주고 delegate를 매개변수로 전달하..
JS Finding out Prime Number We call a number that has only 1 and itself as divisor as Prime number. I was thinking how to get it through code, it was hard but I figured that those numbers divide by any numbers between 1 and itself doesn't divide so here's a code. https://github.com/SoftwareDevJake/PrimeNumber GitHub - SoftwareDevJake/PrimeNumber Contribute to SoftwareDevJake/PrimeNumber development by creating an account o..