14 thg 5, 2012

QuickAction UI Android


Hiện thực được QuickAction UI chúng ta sẽ có hình như sau :
Bài này mình kham khảo từ trang web sau : http://www.edumobile.org/android/android-apps/quick-action-demo/ 


Sourcode Code được cung cấp bởi trang web đó. 
Nếu bạn nào có thắc mắc điều gì, thì để lại comment mình sẽ giải thích nếu có thể.
Bạn nào muốn lấy source code thì để lại email nhé. Chúc vui. 
QuickAction là 1 UI Control không có sẵn trong Android SDK nhé. 

Một loại hiển thị khác của QuickAction 3D.


Một số phương thức vẽ các hình thông dụng


Khi nhấp vào các button thì ứng dụng sẽ vẽ các hình trên các View.
Thứ tự như sau :






Source code ứng dụng :   http://and-sungha-blog.googlecode.com/files/Draw.rar

Multi Choice ListView

Cách sử dụng ListView với nhiều sự lựa chọn. Sử dụng với layout ListView đã được hỗ trợ sẵn.
Các bạn hoàn toàn có thể custom lại ListView với nhiều sự lựa chọn tùy vào ngữ cảnh của ứng dụng.
Dễ dàng nhất là chúng ta sử dụng các tài nguyên đã được xây dựng sẵn.

Code :

public class MutilChoiseListViewActivity extends Activity {
    private ListView choiceLV;
    private String[] choice = { "String A", "String B", "String C", "String D" };

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        choiceLV = (ListView) findViewById(R.id.list);

        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_multiple_choice, choice);
        choiceLV.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        choiceLV.setAdapter(adapter);
       

    }
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </ListView>

</LinearLayout>

Bản beta đầu tiên

Sau 6 tháng cả team cặm cụi làm việc điên cuồng, bản alpha cũng được giới thiệu ra toàn bộ công ty và được testing nội bộ công ty mà thôi. ...