Những control cơ bản cần phải biết trong lập trình android.
Xin chào các Bạn tiếp tục list bài hướng dẫn lập trình android của mình thì bài này. Mình sẽ giới thiệu các Bạn những control cơ bản cần phải nắm rõ để áp dụng vào những ứng dụng của các Bạn sau này. Với các control này thì nếu Bạn nào đã học môn "Môi trường và công cụ lập trình " hay " Lập trình windows form" thì các Bạn có thể liên tưởng để dễ hiểu hơn vì trong android chỉ thay đổi tên gọi thôi và có những control khác. ví dụ trong windows form để hiện thị 1 text là label thì android là TextViews....
Dưới đây mình sẽ list các Control cơ Bản mà các Bạn cần phải nắm rõ. Và với bài này mình sẽ chia làm 2 phần chính đó là Layout và Widget
Phần 1: Các Layout cần phải nắm rõ.
Layout là phần để các Bạn thiết kế giao diện cho ứng dụng của Bạn. Có thể liên tưởng nó giống như vẻ bề ngoài của các Bạn. Và trong 1 layout có thể chứa rất nhiều layout hoặc widget khác nhau. dưới đây là 4 layout các Bạn cần phải nắm rõ.- RelativeLayout
- LinearLayout Ở Layout này có 2 loại các Bạn cần phải biết đó là: LinearLayout( Horizontal) : Với layout này các widget của Bạn bỏ vào sẽ sếp theo kiểu dàn hàng ngang ra. LinearLayout (Vertical) : Với layout này các widget của Bạn bỏ vào sẽ sếp theo kiểu bậc thang từ trên xuống dưới.
- TableLayout
- FrameLayout
- setContentView(R.layout.activity_main);
Phần 2: Các Widget cơ bản cần phải biết trong lập trình android.
- TextView<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Medium Text" android:id="@+id/textView2" />
- Button<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" />
- RadioButton <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New RadioButton" android:id="@+id/radioButton" />
- ListView <ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/listView" />
- GridView <GridView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/gridView" />
- CheckBox <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New CheckBox" android:id="@+id/checkBox" />
- ImageView<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" />
- ImageButton <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageButton" />
- Plain Text (Edit Text) <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/editText" />
- WebView <WebView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/webView" />
- Spinner <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/spinner" />
- VideoView <VideoView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/videoView" />
Comments
Post a Comment