`
essencer
  • 浏览: 9507 次
社区版块
存档分类
最新评论
文章列表
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View view = convertView; ItemViewHolder holder; if (view == null) { view = inflater.inflate(R.layou ...
今日发现Fragment被隐藏后,不能在使用setArguments()传递,否则就会报java.lang.IllegalStateException   原文地址:http://blog.sina.com.cn/u/2477674394 java.lang.IllegalStateException: Fragment already active异常主要是使用setArguments()传递参数导致的。 在 Fragment 没有被添加到 FragmentManager 之前,我们可以通过 Fragment.setArguments() 来设置参数,并在 Fragment 中,使用 ...

Fragment使用

Activity的按钮响应里实现Fragment切换: package com.sg.zh; import android.app.Activity; import android.app.FragmentTransaction; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import com.sg.zh.fragment.FragmentOne; impor ...
package com.jm.jason; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; impo ...
Context android.content.ContextWrapper.getApplicationContext()     Return the context of the single, global Application object of the current process. This generally should only be used if you need a Context whose lifecycle is separate from the current context, that is tied to the lifetime of the pr ...
refer: http://www.eoeandroid.com/thread-76257-1-1.html        dip: device independent pixels(设备独立像素). 不同设备有不同的显示效果,这个和设备硬件有关,一般我们为了支持WVGA、HVGA和QVGA 推荐使用这个,不依赖像素       px: pixels(像素). 不同设备显示效果相同,一般我们HVGA代表320x480像素,这个用的比较多。       pt: point,是一个标准的长度单位,1pt=1/72英寸,用于印刷业,非常简单易用;       sp: scaled pixels ...
    实际开发中,发现ListView中含有Button,ImageButtom,CheckBox等子控件时,ListView本身的Item无法获得单击事件,原因是,里面的子控件优先获得了单击事件。     如何避免?这时候就可以使用descendantFocusability来解决。     关于descendantFocusability属性,开发文档有详细描述:     http://developer.android.com/reference/android/view/ViewGroup.html     该属性是当一个为view获取焦点时,定义viewGroup和其子控 ...
实际开发中发现,当EditText获得焦点,弹出虚拟键盘时,会把UI界面挤上去,如何避免? 在在androidMainfest.xml文件中在对应的Activity中写入如下属性就可以。 android:windowSoftInputMode="adjustPan"  
当引用Android的资源ID(非本地资源ID)时,必须机上android包名,使用TabHost控件时就要如此操作:   When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so: 引用 android:id="@android:id/empty" With the android package namespace in place, we're now refere ...
Global site tag (gtag.js) - Google Analytics