Image operations and time and date selector for Android learning, android Selector

Source: Internet
Author: User

Image operations and time and date selector for Android learning, android Selector

I. Basic Learning

1. ImageView is an image container, which is the direct subclass of View, just like RadioGroup is a RadioButton container.

1 <imageview android:id="@+id/img" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/logo"></imageview>
1 <imageview android:id="@+id/img" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/logo"></imageview>
  1: <ImageView
  2: android:id="@+id/img" 
  3: android:layout_width="fill_parent"
  4: android:layout_height="wrap_content" 
  5: android:src="@drawable/logo"/>


You only need to remember that the image is under res/drawable-xxx.
2. ImageButton (image Button) has nothing to do with the Button. It is an extension of ImageView and its subclass. The Button is a subclass of TextView.

  1: <ImageButton
  2: android:id="@+id/rig" 
  3: android:layout_width="wrap_content"
  4: android:layout_height="wrap_content" 
  5: android:src="@drawable/right"/>

3. TimePicker time selector, which is a direct subclass of FrameLayout (positive layout). The default value is 12 hours.
4. what is the principle of data recovery? In other words, it is the reason why the data can be retrieved again after it is deleted. I wonder if the data is not deleted (the smaller the disk usage, I just removed the corresponding link, but I couldn't find it. Restoring data means restoring the link.
This is also not true, because the recovered data is not directly stored in the original disk, which is strange to me. Now that everything is ready for use, you can use the dummies software for one-click recovery. What is the purpose of learning principles.

Ii. instance analysis

1.TimePicker

  1: package org.lxh.demo;
  2: 
  3: import android.app.Activity;
  4: import android.os.Bundle;
  5: import android.widget.TimePicker;
  6: 
  7: public class MyTimePicker extends Activity {
  8: private TimePicker mytp = null;
  9: /*
10: * The first one is to obtain the system time by default.
11: * The second one is self-written.
 12:  */
 13: 
 14: @Override
 15: public void onCreate(Bundle savedInstanceState) {
 16: super.onCreate(savedInstanceState);
 17: super.setContentView(R.layout.main);
18: this. mytp = (TimePicker) super. findViewById (R. id. tp2); // obtain the component
19: this. mytp. setIs24HourView (true); // set it to the 24-hour format.
20: this. mytp. setCurrentHour (18); // when setting
21: this. mytp. setCurrentMinute (30); // set the score
 22: }
 23: }
main.xml

 

2.DatePicker

Like above, I will not go into details.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.