Skip to content

Instantly share code, notes, and snippets.

z8888q

Block or report user

Report or block z8888q

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@z8888q
z8888q / gist:056ff15d7bfa5fff57985bf4f08e907b
Last active May 31, 2017
Implement dynamic delete or add tab(TAB_C in this test code). Initial Conditions: use Android Studio 2.3.2 create a new Project with a Tabbed Activity, and the Navigation style is Action Bar Tabs(with ViewPager).
View gist:056ff15d7bfa5fff57985bf4f08e907b
package com.zq.testviewpager;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
View ViewTreeObserver_Ex.java
//inside a fragment. If in an Activity you could use findViewById(Window.ID_ANDROID_CONTENT);
getView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
@Override
public void onGlobalLayout()
{
//do something like measure a view etc
View content = getWindow().findViewById(Window.ID_ANDROID_CONTENT);
Log.d("DISPLAY", content.getWidth() + " x " + content.getHeight());
@z8888q
z8888q / gist:9937676
Created Apr 2, 2014
change wordpress Radiate theme header image style.
View gist:9937676
#inc/extras.php
$header = get_header_image();
$header_image = "background-image: url('$header');";
$header_repeat = " background-repeat: no-repeat;";
$header_width = " max-width: 100%; height: 480px; background-size: cover;";
$header_position = " background-position: center bottom;";
$header_attachment = " background-attachment: scroll;";
$header_image_style = $header_image . $header_repeat . $header_width . $header_position . $header_attachment;
View Preferences.sublime-settings
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
// 主题文件的路径
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
@z8888q
z8888q / gist:8314714
Created Jan 8, 2014
Ubuntu 64 install android-sdk
View gist:8314714
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5
sudo apt-get install lib32z1
sudo apt-get install ia32-libs
@z8888q
z8888q / gist:7280681
Last active Apr 11, 2019
How to change an application icon programmatically in Android
View gist:7280681
//1 . Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-//filter section
<activity android:name="ru.quickmessage.pa.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@z8888q
z8888q / index.tmpl
Last active Dec 25, 2015
hunchentoot示例,上级目录是web-demo,参见《Windows上搭建hunchentoot开发环境》http://zhan.renren.com/mobileapp?gid=3602888498043591987
View index.tmpl
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Lisp Web</title>
</head>
<body>
<h1>Lisp web开发实例</h1>
hi, <!-- TMPL_VAR name -->
</body>
@z8888q
z8888q / android自定义圆形Progressbar
Created Jul 17, 2013
android自定义圆形Progressbar
View android自定义圆形Progressbar
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360">
<shape android:shape="ring" android:innerRadiusRatio="3"
android:thicknessRatio="8" android:useLevel="false">
<size android:width="48dip" android:height="48dip" />
View text selectable.java
Android developer: make your text views selectable
September 02, 2012
Historically, support for text selection and copy/paste on Android has been limited to text input fields only. (Some specific applications like the Browser and Gmail have also included their own implementations of text selection from other areas). Fortunately, starting with Android 3.0 the TextView component has built-in support for a consistent, system-wide selection & copying system.
However, this feature is not enabled by default for text views. Very few developers choose to enable it when appropriate: many probably don't even know of its existence. Enabling it is simple and only takes one extra attribute:
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true" />
(Or programmatically:)
@z8888q
z8888q / gist:4480342
Created Jan 8, 2013
android send email
View gist:4480342
Uri uri = Uri.parse("mailto:");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra(Intent.EXTRA_SUBJECT, " 云盘分享文件:" + emailSubject); // 主题
intent.putExtra(Intent.EXTRA_TEXT, emailBody); // 正文
startActivity(Intent.createChooser(intent,
"Select the mail application"));
You can’t perform that action at this time.