1. android:background="@android:drawable/editbox_background"/>
2. FrameLayout mContentView = (FrameLayout)getWindow().getDecorView().findViewById(android.R.id.content);
3. final View zoom = mWebView.getZoomControls(); zoom.getTouchables().get(0).setOnClickListener(new OnClickListener(){
4. ABC<sup>+</sup>
5. static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.CONTACT_STATUS,
Contacts.CONTACT_PRESENCE,
Contacts.PHOTO_ID,
Contacts.LOOKUP_KEY,
};
Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI,
CONTACTS_SUMMARY_PROJECTION, null, null, null);
startManagingCursor(cursor);
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, cursor,
new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
new int[] { android.R.id.text1, android.R.id.text2 });
setListAdapter(mAdapter);
6. onLayout()에서 호출함
view spoof, view original
현재 레이아웃 스크린 좌표 얻기
final int[] globalPos = new int[2];
spoof.getLocationOnScreen(globalPos);
레이이아웃에 위치를 지정해 주기
spoof.layout(x, y, x + original.getWidth(), y + original.getHeight());
onMeasure(int, int) Called to determine the size requirements for this view and all of its children.
onLayout(boolean, int, int, int, int)
private void showOverlay() {
ToastViewOverlay overlay = (ToastViewOverlay)
getLayoutInflater().inflate(R.layout.secure_view_overlay, null);
overlay.setActivityToSpoof(this);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.FILL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(overlay);
toast.show();
}
7.
int timeout = 10000;
SocketAddress socketAddress = new InetSocketAddress("192.168.10.77", 6001);
sock = new Socket();
sock.setReceiveBufferSize(64000);
sock.setSoTimeout(30000);
sock.setSoLinger(true, timeout);
sock.connect(socketAddress, timeout);
PrintWriter out = new PrintWriter( new
BufferedWriter( new OutputStreamWriter(sock.getOutputStream())),true);
out.println(message);
// sleep(20000);
BufferedReader input = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String st = input.readLine();
8. // setTheme(android.R.style.Theme);
// setTheme(android.R.style.Theme_Light);
// setTheme(R.style.Theme_Translucent);
setTheme(R.style.Theme_Transparent);
setContentView(R.layout.main);
9. public static final String testContent = "<html><body><b>HTML 문서를 TextView에 출력합니다.</b><font size='+1'>크게</font>"
+ "<img src=\"http://developer.android.com/assets/images/home/honeycomb-android.png\"/></body></html>";
tvText.setText(Html.fromHtml(testContent, imgGetter, null));
private final ImageGetter imgGetter = new ImageGetter() {
@Override
public Drawable getDrawable(String source) {
HttpGet get = new HttpGet(source);
DefaultHttpClient client = new DefaultHttpClient();
Drawable drawable = null;
try {
HttpResponse response = client.execute(get);
StatusLine status = response.getStatusLine();
if (status.getStatusCode() != 200)
return null;
InputStream stream = response.getEntity().getContent();
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File file = new File(path, "HtmlPicture.png");
FileOutputStream fileout = new FileOutputStream(file);
byte buf[] = new byte[8192];
int len;
while ((len =stream.read(buf)) > 0) {
fileout.write(buf, 0, len);
}
fileout.close();
drawable = Drawable.createFromPath(file.toString());
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return drawable;
}
};
10. http://developer.android.com/reference/android/R.drawable.html
public class HelloTabs extends TabActivity implements TabHost.TabContentFactory {
View v;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabHost = getTabHost();
LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true);
tabHost.addTab(tabHost.newTabSpec("tab1")
.setIndicator("tab1", getResources().getDrawable(android.R.drawable.star_big_on))
.setContent(R.id.view1));
tabHost.addTab(tabHost.newTabSpec("tab2")
.setIndicator("tab2", getResources().getDrawable(android.R.drawable.star_big_off))
.setContent(R.id.view2));
tabHost.addTab(tabHost.newTabSpec("tab3")
.setIndicator("tab3", getResources().getDrawable(android.R.drawable.stat_notify_call_mute))
.setContent(this));
}
@Override
public View createTabContent(String tag) {
TextView tv = new TextView(this);
tv.setText("Content for tab with tag " + tag);
return tv;
}
}
11. private static int MOOD_NOTIFICATIONS = R.layout.main;
private NotificationManager mNM;
private final int[] mood = {R.drawable.stat_happy,R.drawable.stat_neutral,R.drawable.stat_sad};
private final int[] message = {R.string.status_bar_happy_message,R.string.status_bar_ok_message, R.string.status_bar_sad_message};
CharSequence text = getText(textId);
Notification notification = new Notification(moodId, text, System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, SyncThread.class), 0);
notification.setLatestEventInfo(this, getText(R.string.status_bar_mood_title),
text, contentIntent);
mNM.notify(MOOD_NOTIFICATIONS, notification);
12.
private void addEvent(String title) {
SQLiteDatabase db = hostData.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(HostDatabase.TIME, System.currentTimeMillis());
values.put(HostDatabase.TITLE, title);
db.insert(HostDatabase.TABLE, null, values);
}
private void deleteEvent(String title) {
SQLiteDatabase db = hostData.getWritableDatabase();
db.delete(HostDatabase.TABLE, "tiltle=?", new String[] {title});
}
private void updateEvent(String title) {
SQLiteDatabase db = hostData.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(HostDatabase.TIME, System.currentTimeMillis());
db.update(HostDatabase.TABLE, values, "tiltle=?", new String[] {title});
}
private Cursor getEvents() {
SQLiteDatabase db = hostData.getReadableDatabase();
Cursor cursor = db.query(HostDatabase.TABLE, null, null, null, null,
null, null);
startManagingCursor(cursor);
return cursor;
}
private void showEvents(Cursor cursor) {
StringBuilder ret = new StringBuilder("Saved Events:\n\n");
while (cursor.moveToNext()) {
long id = cursor.getLong(0);
long time = cursor.getLong(1);
String des = cursor.getString(2);
ret.append(id + ": " + time + ": " + des + "\n");
}
output.setText(ret);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table " + TABLE + "( " + BaseColumns._ID
+ " integer primary key autoincrement, " + TIME + " integer, "
+ TITLE + " text not null);";
Log.d("EventsData", "onCreate: " + sql);
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion >= newVersion)
return;
String sql = null;
if (oldVersion == 1)
sql = "alter table " + TABLE + " add note text;";
if (oldVersion == 2)
sql = "";
Log.d("EventsData", "onUpgrade : " + sql);
if (sql != null)
db.execSQL(sql);
}
13. <ProgressBar android:id="@+android:id/progress_large"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar android:id="@+android:id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar android:id="@+android:id/progress_small"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar android:id="@+android:id/progress_small_title"
style="?android:attr/progressBarStyleSmallTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
// Request for the progress bar to be shown in the title
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
// Make sure the progress bar is visible
setProgressBarVisibility(true);
14. android:bufferType="spannable"
http://blog.naver.com/taiji567?Redirect=Log&logNo=109529292
댓글 없음:
댓글 쓰기