To get (current project) using mymodule in the ant build process. Add this line to default.properties:
android.library.reference.1=../mymodule
For test projects referencing the source projects see here
Andy's Android Notes
Tuesday, 21 February 2012
Wednesday, 9 November 2011
Emulator and avd notes:
to create a test project:
android update test-project -m ./path/main_project/ -p ./path/test_project/
to launch emulator:
emulator -avd
ADB server & list attached devices
adb devices
adb start-server
android update test-project -m ./path/main_project/ -p ./path/test_project/
to launch emulator:
emulator -avd
ADB server & list attached devices
adb devices
adb start-server
Thursday, 20 October 2011
Thursday, 13 October 2011
Button at bottom of screen
The whole gravity / layout_gravity thing is a bit confusing so here is a snippet:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="center_horizontal|bottom">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Back "
android:id="@+id/btn_back"/>
</LinearLayout>
Tuesday, 4 October 2011
Friday, 23 September 2011
Sliding notifications
How 2 add a slidey notification into your Android project
In Drawable:
In your layout XML
in Java:
In Drawable:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#C999" />
<corners android:topLeftRadius="10sp"
android:topRightRadius="10sp"/>
<stroke android:color="#000000"
android:width="1sp"/>
</shape>
In your layout XML
<TextView android:id="@+id/Message"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center"
android:layout_gravity="bottom"
android:textSize="10pt"
android:padding="10dp"
android:textColor="@android:color/black"
android:background="@drawable/popup_background"
android:text="POPUP MESSAGE" />
in Java:
AnimationSet slide = new AnimationSet(true);
Animation animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 1.5f,
Animation.RELATIVE_TO_SELF, 0f);
animation.setDuration(1000);
animation.setFillAfter(true);
slide.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1.5f);
animation.setDuration(1000);
animation.setStartOffset(3000);
animation.setFillAfter(true);
slide.addAnimation(animation);
slide.setFillAfter(true);
messageObject.startAnimation(slide);
Saturday, 3 September 2011
sample buttons
base button:
button in normal state:
button in pressed state:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:constantSize ="true">
<item android:state_pressed="true" android:drawable="@drawable/black_pressed" />
<item android:drawable="@drawable/black_normal" />
</selector>
button in normal state:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:startColor="#666666"
android:endColor="#000000"
android:angle="270"/>
<corners android:radius="10sp"/>
<stroke android:color="#000000"
android:width="1sp"/>
</shape>
button in pressed state:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#666666"
android:endColor="#AAAAAA"
android:angle="90"/>
<corners android:radius="10sp"/>
<stroke android:color="#000000"
android:width="2sp"/>
</shape>
Subscribe to:
Posts (Atom)