5/17/2017
5/01/2017
JavaScript : Tour of heroes using React and Redux
See the Pen Tour of heroes using React and Redux by Marx Tseng (@marxtseng) on CodePen.
4/26/2017
JavaScript : Tour of heroes using Vue.js
See the Pen Tour of heroes using Vue.js by Marx Tseng (@marxtseng) on CodePen.
4/11/2017
4/08/2017
3/16/2017
3/15/2017
JavaScript : Tour of heroes using AngularJS 1.x
See the Pen Tour of heroes using AngularJS 1.x by Marx Tseng (@marxtseng) on CodePen.
3/10/2017
PostgreSQL : 試試 JSON 函數
insert into members (name, gender, blood, age)
select j1.key "name", j1.value "gender", j2.value "blood", j3.value "age"
from json_each_text('{"Chris":"Male", "Kelly":"Female"}') as j1
join json_each_text('{"Chris":"A", "Kelly":"O"}') as j2 on j2.key = j1.key
join json_each_text('{"Chris":"42", "Kelly":"34"}') as j3 on j3.key = j1.key
"Chris";"Male";"A";"42" "Kelly";"Female";"O";"34"JSON Functions and Operators
2/18/2017
2/15/2017
2/13/2017
Android : SwipeRefreshLayout + RecyclerView + CardView
1/26/2017
Android : 自訂 Spinner 下拉式選單様式
spinner_dropdown.java
......
final String[] items = new String[] {"1","2","3","4","5"};
ArrayAdapter adapter = new ArrayAdapter<>(view.getContext(), R.layout.spinner_dropdown_title, items);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
mSpinner.setAdapter(adapter);
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView parent, View view, int position, long id) {
Toast.makeText(getActivity(), "Item selected " + items[position] , Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView parent) {
}
});
......
spinner_dropdown_title.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/spinnerDropDownItemStyle"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textColor="@color/colorDark87"/>
spinner_dropdown_item.xml
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:paddingTop="@dimen/dimen8dp"
android:paddingRight="@dimen/dimen16dp"
android:paddingBottom="@dimen/dimen8dp"
android:paddingLeft="@dimen/dimen16dp"
android:textColor="@color/colorDark87"/>
1/23/2017
Android : TabLayout + ViewPager 實做滑動標籤效果
activity_main.html
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="marxtseng.a1know.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.addTab(tabLayout.newTab().setText(R.string.course));
tabLayout.addTab(tabLayout.newTab().setText(R.string.task));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
final PageAdapter adapter = new PageAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
final ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
}
PageAdapter.java
public class PageAdapter extends FragmentStatePagerAdapter {
private int mNumOfTabs;
public PageAdapter(FragmentManager fm, int numOfTabs) {
super(fm);
this.mNumOfTabs = numOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
CourseFragment courseFragment = new CourseFragment();
return courseFragment;
case 1:
TaskFragment taskFragment = new TaskFragment();
return taskFragment;
default:
return null;
}
}
@Override
public int getCount() {
return mNumOfTabs;
}
}
1/17/2017
1/16/2017
JavaScript : Tour of heroes using Polymer and Redux
See the Pen Tour of heroes using Polymer and Redux by Marx Tseng (@marxtseng) on CodePen.
1/04/2017
訂閱:
意見 (Atom)
-
See the Pen Tour of heroes using Vue.js by Marx Tseng ( @marxtseng ) on CodePen .


