Skip to content

Instantly share code, notes, and snippets.

View Reacoder's full-sized avatar

赵小龙_同学 Reacoder

  • shanghai china
View GitHub Profile
@Reacoder
Reacoder / TextWithUnit.java
Created October 13, 2014 15:55
TextWithUnit , upper right corner.
package com.example.zhaosam.textviewtest;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextView;
@Reacoder
Reacoder / theme
Created September 28, 2014 10:43
theme path for android studio.
/Users/samzhao/Library/Preferences/AndroidStudioBeta/colors
@Reacoder
Reacoder / focus
Created September 4, 2014 04:22
edittext 取消focus
For the EditText's parent view, let the following 3 attributes be "true":
clickable, focusable, focusableOnTouch.
If a view want to receive focus, it must satisfy these 3 conditions.
See android.view :
@Reacoder
Reacoder / gitignore
Created September 2, 2014 08:35
make gitignore work.
Even if you haven't tracked the files so far, git seems to be able to "know" about them even after you add them to .gitignore.
A quick fix that I've used was to run the following commands from the top folder of your git repo:
(edited)
git rm -r --cached .
Followed by:
git add .
and
@Reacoder
Reacoder / actionbar.java
Last active August 29, 2015 14:05
更换 actionBar 的 icon
<activity
android:name="com.ilegendsoft.toprankapps.tubeplayer.activities.PlayVideoActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop"
android:logo="@drawable/play_video_back" >
</activity>
<?xml version="1.0" encoding="utf-8"?>
<layer-list
@Reacoder
Reacoder / Theme.AppCompat.Light.NoActionBar.xml
Created August 19, 2014 02:05
Theme.AppCompat.Light.NoActionBar
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
List<Fruit> fruits= new ArrayList<Fruit>();
Fruit fruit;
for(int i=0;i<100;i++)
{
fruit = new fruit();
fruit.setname(...);
fruits.add(fruit);
}
@Reacoder
Reacoder / FSUtil.java
Created August 8, 2014 10:38
获得 sdcard 空间。
package com.ilegendsoft.toprankapps.tubeplayer.utils;
import android.os.Environment;
import android.os.StatFs;
public class FSUtil {
// One binary gigabyte equals 1,073,741,824 bytes.
private static final long PER_G_NUM = 1073741824;
public static String getAvailableSpace() {
@Reacoder
Reacoder / SeekBar.xml
Created August 8, 2014 08:29
自定义seekBar
<SeekBar
android:id="@+id/mediacontroller_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="24dp"
android:maxHeight="2dp"
android:progressDrawable="@drawable/seekbar"
android:thumb="@drawable/seekbar_thumb" />
@Reacoder
Reacoder / PopupWindow.java
Created August 5, 2014 09:30
PopupWindow - Dismiss when clicked outside
mFilterWindow = new PopupWindow(popupLayout,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT);
mFilterWindow.setOutsideTouchable(true);
mFilterWindow.setBackgroundDrawable(new ColorDrawable());
mFilterWindow.setFocusable(true);