- 博客(15)
- 收藏
- 关注
转载 ====android:layout_gravity设置无效
当作为父layout的LinearLayout的属性为android:orientation="vertical" 的时候,android:layout_gravity="?"这里设为横向的时候才能生效。比如:left,right,center_horizontal等; 当作为父layout的LinearLayout的属性为android:orientation="horizental" 的时候
2016-01-11 17:49:04 504
原创 ====imageview的屏幕适配
ImageView img = (ImageView) convertView.findViewById(R.id.themeandbackground_theme); // img.setLayoutParams(new RelativeLayout.LayoutParams((Helper.getDisplayWidth() - Helper.dip2px(60)
2015-12-17 16:52:26 255
原创 ====如何在framelayout中自动循环childview
final int childCount = getChildCount(); if (childCount > 1) { for (int i = 0; i ; i++) { View child = getChildAt(i); if (i == 0) { bringChildToFront(child); }
2015-12-16 11:38:17 255
原创 ====如何通过捕获异常来防止空指针ANR
RecordTag tag = null; try { tag = (RecordTag) listView.getAdapter().getItem(position); } catch (Exception e) { e.printStackTrace(); } if (tag == null) return; mmedlg = new JiyibiMembersMan
2015-12-10 17:51:35 408
原创 ====如何设置手势
private GestureDetector detector; 先定义一个对象 public JiyibiMembersManagerEditDialog(Context context, int theme, RecordTag tag, MembersManagerEditCallBack mMECallBack) { super(context, them
2015-12-07 10:20:09 265
原创 ==== 如何写自己的回调函数
public interface MembersManagerCallBack { void mMCallBack(ArrayList recordTagList); } 在一个类中定义一个回调函数并在该类中为回调函数设置带回值 callBack.mMCallBack(recordTagList); 在另外一个类中初始化上一个类的时候就要执行回调函数,获取到回调返回的
2015-12-06 16:51:23 271
原创 ====在界面初始化之后就要弹出软键盘,与收起软键盘
imm.showSoftInput(addNewMember, InputMethodManager.RESULT_SHOWN); // imm.showSoftInput(addNewMember,InputMethodManager.SHOW_FORCED); imm.toggleSoftInput(InputMethodManag
2015-12-06 16:47:53 397
原创 ====监听textview中输入的变化
addNewMember.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextC
2015-12-05 15:58:32 407
原创 ====Scroll包裹的List View中监听Scroll
/*listView.setOnScrollListener(new AbsListView.OnScrollListener() { //正在滚动时回调,回调2-3次,手指没抛则回调2次。scrollState = 2的这次不回调 //回调顺序如下 //第1次:scrollState = SCROLL_STATE_TOUCH_SCROLL(1) 正在滚动 //第2
2015-12-05 15:56:52 226
原创 ====手势的使用
private GestureDetector detector; this.detector = new GestureDetector(getContext(), new ViewGestureListener()); class ViewGestureListener implements GestureDetector.OnGestureListener {
2015-12-05 15:54:13 206
原创 ==== 如何写自己的Listerner监听器
public interface SelectDialogDisMissListerner{ void DialogDisMissListerner(HashSet aDialog); } SelectDialogDisMissListerner disMissLinterner; public void setSelectDialogDisMissListerner(SelectDi
2015-12-05 15:50:39 343
原创 ====如何使dialog的高度随item的变化而变化
Window window = getWindow(); window.setGravity(Gravity.BOTTOM); unitHeight = Controller.dip2px(aty, unitHeight); int dialogH = 0; int displayH = Controller.getDisplayHeight(aty) - Controller.dip2px(at
2015-12-05 15:49:19 527
原创 ===item填充导致layout显示和想要的不同
<ScrollView android:id="@+id/new_horizontalScrollView" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:scrollbars="non
2015-12-05 15:43:28 250
原创 ====R.styleable如何使用
//在.Java中定义如下的内容 final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView); rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColo
2015-11-21 19:52:30 567
原创 ====Android Studio Debug报错
public class NewKeyboard extends LinearLayout{ public NewKeyboard(Context context,EditTextTypeFaceZh editTextzh) { super(context); LayoutInflater inflater= (LayoutInflater) context.getSystemS
2015-11-20 20:47:53 260
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人