2016년 8월 11일 목요일

android AppCompat을 상속 받은 activity의 배경 투명 으로 만들기


AndroidManifest.xml
파일의 activity의 속성에 theme를 다음과 같이 한다
android:theme="@style/TransparentTheme"

res > values > styles.xml의 다은 내용을 추가 한다.
<style name="TransparentTheme" parent="@style/Theme.AppCompat">    
    <item name="android:background">@null</item>    
    <item name="background">@null</item>
    <item name="android:windowBackground">@android:color/transparent</item>    
<item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@null</item>
    <item name="windowNoTitle">true</item></style>
<color name="transparent">#00FFFFFF</color>


///////////// 추가 ////////////////
    <item name="android:windowIsTranslucent">true</item> 
    만 주게 되면 배경이 투명하게 됨.

    <item name="windowNoTitle">true</item></style>
    title 바가 없어짐.

끝.

2016년 8월 10일 수요일

javascript webgl 좌표를 -1에서 1 사이의 값으로 변환하기



- 좌표를 -1에서 1 사이의 값으로 변환하기
 + function normalizedPoint(x, y)
{
  // converts screen coordinates to -1 to 1
  var canvas = document.getElementById("2dcanvas");
    x = (x / canvas.width) * 2 - 1;
    y = (1 - (y / canvas.height)) * 2 - 1;
   
    return new Point(x, y);
}