This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When a user interacts with a UI element the various listeners are called in a top down order. (For example: OnTouch -> OnFocusChange -> OnClick.) If a listener has been defined (with setOn...Listener) and it consumes this event: the lower priority listeners will not be called. By its nature the first time you touch an EditText it receives focus with OnFocusChangeListener so that the user can type. The action is consumed here therefor OnClick is not called. Each successive touch doesn't change the focus so the event trickles down to the OnClickListener. | |
Basically, you have three choices: | |
Set the focusable attribute to false in your XML: | |
android:focusable="false" | |
Now the OnClickListener will fire every time it is clicked. But this makes the EditText useless since the user can no longer enter any text... | |
Implement an OnFocusChangeListener along with the OnClickListener: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Clear all Fragments inside current adapter */ | |
public class MyPagerAdapter extends FragmentPagerAdapter | |
{ | |
private ArrayList<Fragment> fragments=new ArrayList<Fragment>(); | |
//...some stuff | |
public void clearAll() //Clear all page | |
{ | |
for(int i=0; i<fragments.size(); i++) | |
fragMan.beginTransaction().remove(fragments.get(i)).commit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ilegendsoft.toprankapps.musictube.adapters; | |
import android.content.Context; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentPagerAdapter; | |
import com.toprankapps.musictube4.R; | |
import com.ilegendsoft.toprankapps.musictube.fragments.HotArtistFragment; | |
import com.ilegendsoft.toprankapps.musictube.fragments.PopularFragment; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TableLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="12dp" > | |
<TableRow> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*F1 显示声明。 | |
Shift+F1 浏览器查看声明 | |
*Command+B 进入源码。 | |
Command+F12 显示类中的所有方法。 | |
*Option+Enter 修复提示,还可以提取字符串到value中。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static String getRealPlayUrl(String playUrlWithTempSig, String sig) { | |
// http://r13---sn-a5m7ln7r.googlevideo.com/videoplayback? | |
// sparams=gcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&source=youtube | |
// &signature=74A5A84D017C326B86FBB2515BD6C00BCD85133A.E1CB6514CD41B99045FF236A3F7CF0F50F4AEC14&itag=22&key=yt5&mws=yes&gcr=cn&ms=au | |
// &ipbits=0&ratebypass=yes&expire=1406281956&upn=raAqucAppMU&id=o-AP5UIALOxGG5ae6zN-JNagnKvRQa_WtGXk8czf3NgFuW&mv=u&sver=3&ip=199.245.60.115 | |
// &fexp=902408%2C924222%2C927622%2C934024%2C934030%2C941431%2C945066%2C946023&mt=1406260337&initcwndbps=1093375 | |
String realUrl = playUrlWithTempSig.replaceFirst("signature="+"[^&]*", "signature="+sig); | |
System.out.println("======= realUrl ======="+realUrl); | |
return realUrl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void moveUserInfoLayoutInY(int marginTop) { | |
MarginLayoutParams marginParams = new MarginLayoutParams(mUserInfoLayout.getLayoutParams()); | |
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, marginTop, getResources().getDisplayMetrics()); | |
marginParams.setMargins((int)mUserInfoLayout.getLeft(), (int)px, 0, 0); | |
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams); | |
mUserInfoLayout.setLayoutParams(layoutParams); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
short answer: | |
when inflating for convertView, instead of just | |
result = inf.inflate(R.layout.thread_item, null); | |
do | |
result = inf.inflate(R.layout.thread_item, parent, false); | |
explanation: |