posted by Full-stack Developer 2011. 10. 12. 18:21
Step 1. Create CustomButton.xml
res/drawable/custombtn.xml <- create custombtn.xml

 <?xml version="1.0" encoding="utf-8"?> 
<selector  xmlns:android="http://schemas.android.com/apk/res/android">
<item 
    android:state_pressed="false"
    android:drawable="@drawable/bu4_searchall"/>
<item 
    android:drawable="@drawable/bu4_searchall_o"/>
</selector> 

Step 2. To Use 
-ex)res/layout/main.xml 
...
<ImageView
android:src="@drawable/custombtn"
android:id="@+id/main_pressedimgtest_iv" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
/> 
... 

Step 3. SetOnClickListener
-user source  ex)src/com.xxx.xxx/main.java
...
 ImageView custombtn = (ImageView)findViewById(R.id.main_pressedimgtest_iv);
 custombtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
... 

안녕하세요 ^^
설명을 해드릴까 합니다.

이건 하단 컨트롤바같은 UI를 만들때 사용자가 press할때 이미지를 변경해주는 방법이에요.
사용자에게 터치감을 주기위해서 사용했습니다.

방법은 우선 버튼의 Step1처럼 버튼 누를시 이미지 변경되게 구현하구요
Step2에서 구현한 커스텀UI를 적용해요  Step2에 노란색 부분을 보시면 알수있겠죠?
Step3에서 클릭이벤트를 설정해줘야 press를 하겠죠?

도움되셧길 바랍니다. ㅎ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 5. 17:15
1.
<CheckBox
android:id="@+id/setting_idsave_cb"
android:button="@drawable/checkbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="아이디저장"
android:textColor="#9b9d9d"
android:textSize="16px"
android:paddingRight="35px"/>

2.
dir is.. res/drawable/checkbtn.xml

<?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item 
        android:state_checked="true"
        android:drawable="@drawable/img_checked" />
    <item
        android:drawable="@drawable/img_check" />
</selecto 
 

안녕하세요 ^^
설명을 해보겠습니다!

사용방법은 1번과같이 button을 커스텀한 checkbox로 세팅해주시면됩니다.
2과같이 체그될때 이미지, 체크안될을때 이미지를 설정해주시면 끗!

도움되셧길 바랍니다 ㅎ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 5. 16:52
1.
<RadioButton
android:id="@+id/setting_p_rb"
android:button="@drawable/radiobtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="개인회원 "
android:textColor="#9b9d9d"
android:textSize="16px"
android:layout_marginBottom="5px"
android:layout_marginTop="2px"
android:paddingRight="47px"/> 

2.
dir is .. res/drawable/radiobtn.xml

<?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item 
        android:state_checked="true"
        android:drawable="@drawable/i_radio_ch" />
    <item
        android:drawable="@drawable/i_radio" />
</selector> 

ch -> checked 

안녕하세요 ^^
설명을 잠시 해보겠어요.
CheckBox와 같은 방식으로 2번처럼 커스텀한 UI 1번처럼 button에 UI를 세팅해주시면 됩니다.

도움되셧길 바랍니다 ㅎ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 5. 16:33
1.
<ProgressBar
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:paddingTop="20px"
  android:indeterminateDrawable="@drawable/loadingspin"
  android:animationResolution="1"
  />

 2.
dir is .. res/drawable/loadingspin.xml

<?xml version="1.0" encoding="utf-8"?>
 <layer-list  xmlns:android="http://schemas.android.com/apk/res/android">
 <item>
  <rotate 
  android:drawable="@drawable/loading" ------------------------------↘


  android:pivotX="50%"
  android:pivotY="50%"
  android:fromDegrees="0"
  android:toDegrees="1080"
/>
  </item>
  </layer-list>

 

안녕하세요 ^^
잠시 설명을 해보겟습니다.

2번처럼 UI를 xml를 구현해주세요. drawable에 원하시는 png로 되있는 로딩 이미지를
세팅해주시고
1번처럼 indeterminateDrawable에 구현한 UI를 세팅해주시면 됩니다.

도움되셨으면 좋겠네요 ㅎ

즐코딩! 낫빡침!