android.widget.LinearLayout#setOnClickListener ( )源码实例Demo

下面列出了android.widget.LinearLayout#setOnClickListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: evercam-android   文件: EditCameraActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.activity_add_edit_camera, menu);

    MenuItem supportMenuItem = menu.findItem(R.id.menu_action_support);
    if (supportMenuItem != null) {
        LinearLayout menuLayout = (LinearLayout) LayoutInflater.from(this)
                .inflate(R.layout.menu_support_lowercase, null);
        supportMenuItem.setActionView(menuLayout);
        supportMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        menuLayout.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intercom.client().displayConversationsList();
            }
        });
    }

    return true;
}
 
源代码2 项目: GithubApp   文件: LinearBreadcrumb.java
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
    LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
    view.setTag(mCrumbs.size());
    view.setOnClickListener(this);

    ImageView iv = (ImageView) view.getChildAt(1);
    Drawable arrow = getResources().getDrawable(R.drawable.ic_right_arrow);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (arrow != null) {
            arrow.setAutoMirrored(true);
        }
    }
    iv.setImageDrawable(arrow);
    iv.setVisibility(View.GONE);

    mChildFrame.addView(view, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mCrumbs.add(crumb);
    if (refreshLayout) {
        mActive = mCrumbs.size() - 1;
        requestLayout();
    }
    invalidateActivatedAll();
}
 
源代码3 项目: Viewer   文件: BaseActivity.java
public void customTitleBar(int layoutId, String title, int backId, int optId, int hiddenType) {
	getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, layoutId);
	TextView titleText = (TextView) findViewById(R.id.title);
	titleText.setText(title);
	LinearLayout back_linlayout = (LinearLayout) findViewById(R.id.back_linlayout);
	LinearLayout opt_linlayout = (LinearLayout) findViewById(R.id.opt_linlayout);
	TextView optBtn = (TextView) findViewById(R.id.opt);
	
	if (hiddenType == HIDDEN_BACK) {
		back_linlayout.setVisibility(View.GONE);
		optBtn.setText(optId);
	} else if (hiddenType == HIDDEN_OPT) {
		opt_linlayout.setVisibility(View.GONE);
	} else if (hiddenType == (HIDDEN_OPT | HIDDEN_BACK)) {
		back_linlayout.setVisibility(View.GONE);
		opt_linlayout.setVisibility(View.GONE);
	}else{
		optBtn.setText(optId);
	}
	opt_linlayout.setOnClickListener(this);
	back_linlayout.setOnClickListener(this);
}
 
源代码4 项目: weixin   文件: MeFragment.java
private void initView(View v) {
	LinearLayout mLl_userInfo = (LinearLayout) v.findViewById(R.id.cgt_ll_me_userInfo);
	mIv_userPic = (ImageView) v.findViewById(R.id.cgt_iv_me_userPic);
	mTv_userName = (TextView) v.findViewById(R.id.cgt_tv_me_userName);
	mTv_weixinNum = (TextView) v.findViewById(R.id.cgt_tv_me_weixinNum);
	ImageButton mIb_qrCOde = (ImageButton) v.findViewById(R.id.cgt_ib_me_qrCode);

	LinearLayout mLl_photo = (LinearLayout) v.findViewById(R.id.cgt_ll_me_photo);
	LinearLayout mLl_collect = (LinearLayout) v.findViewById(R.id.cgt_ll_me_collect);
	LinearLayout mLl_wallet = (LinearLayout) v.findViewById(R.id.cgt_ll_me_wallet);
	LinearLayout mLl_set = (LinearLayout) v.findViewById(R.id.cgt_ll_me_set);

	mLl_userInfo.setOnClickListener(this);
	mIb_qrCOde.setOnClickListener(this);
	mLl_photo.setOnClickListener(this);
	mLl_collect.setOnClickListener(this);
	mLl_wallet.setOnClickListener(this);
	mLl_set.setOnClickListener(this);
}
 
源代码5 项目: always-on-amoled   文件: DeveloperActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_developer);
    ButterKnife.bind(this);
    for (LinearLayout developerLink : developerLinks) {
        developerLink.setOnClickListener(this);
    }
}
 
源代码6 项目: wakao-app   文件: FunnyFragment.java
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      //inflater the layout
      List<FunnyObj> funnyData = new ArrayList<FunnyObj>();
      LinearLayout wrapLayout = (LinearLayout)inflater.inflate(R.layout.funnyfragment, null);
      RelativeLayout footerbar = (RelativeLayout)wrapLayout.findViewById(R.id.footer_bar);
      initFooterBar(footerbar);
      PullToRefreshListView listview = (PullToRefreshListView)wrapLayout.findViewById(R.id.funnylistview);
      
      LinearLayout footerLayout = (LinearLayout)inflater.inflate(R.layout.listview_footer, null);
      footerLayout.setOnClickListener(this);
      listview.addFooterView(footerLayout);
      
      ListviewFunnyAdapter adapter = new ListviewFunnyAdapter(getActivity(), funnyData, R.layout.listitem_funny);
      
Handler handler = HandlerFactory.createListviewHandler(listview, footerLayout, adapter);

robot = new FunnyRobot(listview, handler, funnyData);
robot.setContext(getActivity());
robot.setCacheDir(getActivity().getCacheDir().getAbsolutePath());

listview.setAdapter(adapter);
listview.setOnScrollListener(robot);
listview.setOnRefreshListener(robot);
Log.e("TAG", "FunnyFragment create");

      return wrapLayout;
  }
 
源代码7 项目: nono-android   文件: SelectPicActivity.java
private void initView() {
	dialogLayout = (LinearLayout) findViewById(R.id.select_pic_dialog_layout);
	dialogLayout.setOnClickListener(this);
	takePhotoBtn = (TextView) findViewById(R.id.select_pic_btn_take_photo);
	takePhotoBtn.setOnClickListener(this);
	pickPhotoBtn = (TextView) findViewById(R.id.select_pic_btn_pick_photo);
	pickPhotoBtn.setOnClickListener(this);
	cancelBtn = (TextView) findViewById(R.id.select_pic_btn_cancel);
	cancelBtn.setOnClickListener(this);
	
	lastIntent = getIntent();
}
 
public DialogAddressWithShowPrivateKey(Activity context, Address address,
                                       DialogAddressAlias.DialogAddressAliasDelegate
                                               aliasDelegate) {
    super(context);
    this.activity = context;
    this.address = address;
    this.aliasDelegate = aliasDelegate;
    setOnDismissListener(this);
    setContentView(R.layout.dialog_address_with_show_private_key);
    llOriginQRCode = (LinearLayout) findViewById(R.id.ll_origin_qr_code);
    llSignMessage = (LinearLayout) findViewById(R.id.ll_sign_message);
    findViewById(R.id.tv_view_show_private_key).setOnClickListener(this);
    findViewById(R.id.tv_private_key_qr_code_decrypted).setOnClickListener(this);
    findViewById(R.id.tv_private_key_qr_code_encrypted).setOnClickListener(this);
    findViewById(R.id.tv_private_key_qr_code_bip38).setOnClickListener(this);
    findViewById(R.id.tv_trash_private_key).setOnClickListener(this);
    findViewById(R.id.ll_address_alias).setOnClickListener(this);
    llOriginQRCode.setOnClickListener(this);
    llOriginQRCode.setVisibility(View.GONE);
    if (AppSharedPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD) {
        llSignMessage.setVisibility(View.VISIBLE);
        llSignMessage.setOnClickListener(this);
    } else {
        llSignMessage.setVisibility(View.GONE);
    }
    findViewById(R.id.tv_close).setOnClickListener(this);
    dialogQr = new DialogFancyQrCode(context, address.getAddress(), false, true);
    dialogPrivateKey = new DialogPrivateKeyQrCode(context, address.getFullEncryptPrivKey(),
            address.getAddress());
    if (aliasDelegate == null) {
        findViewById(R.id.ll_address_alias).setVisibility(View.GONE);
    }
}
 
源代码9 项目: SprintNBA   文件: FixedIndicatorView.java
@Override
public void onChange() {
	if (!inRun.isFinished()) {
		inRun.stop();
	}
	positionOffset = 0;
	int count = getChildCount();
	int newCount = mAdapter.getCount();
	views.clear();
	for (int i = 0; i < count && i < newCount; i++) {
		views.add((ViewGroup) getChildAt(i));
	}
	removeAllViews();
	int size = views.size();
	for (int i = 0; i < newCount; i++) {
		LinearLayout result = new LinearLayout(getContext());
		View view;
		if (i < size) {
			View temp = views.get(i).getChildAt(0);
			views.get(i).removeView(temp);
			view = mAdapter.getView(i, temp, result);
		} else {
			view = mAdapter.getView(i, null, result);
		}
		result.addView(view);
		result.setOnClickListener(onClickListener);
		result.setTag(i);
		addView(result, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	}
	mPreSelectedTabIndex = -1;
	setCurrentItem(mSelectedTabIndex, false);
	measureTabs();
}
 
源代码10 项目: MyHearts   文件: LordFragment.java
private void initPopup() {
        View popupWindow = LayoutInflater.from(getContext())
                .inflate(R.layout.lord_popup_window_layout, null);

        mReAddGroup = (RelativeLayout) popupWindow.findViewById(R.id.re_add_group);
        mReAddGroup.setOnClickListener(this);
        mReSearchGroup = (RelativeLayout) popupWindow.findViewById(R.id.re_search_group);
        mReSearchGroup.setOnClickListener(this);
        mPopupWindow = new PopupWindow(popupWindow);
        mPopupWindow.setWidth(ViewGroup.LayoutParams.FILL_PARENT);
        mPopupWindow.setHeight(ViewGroup.LayoutParams.FILL_PARENT);
        mPopupWindow.setTouchable(true);
        mPopupWindow.setOutsideTouchable(true);
        mPopupWindow.setBackgroundDrawable(new BitmapDrawable(getContext().getResources()));

        mLlDismiss = (LinearLayout) popupWindow.findViewById(R.id.ll_dismiss);
        mLlDismiss.setOnClickListener(view -> {
            mPopupWindow.dismiss();
        });

//        // 设置背景颜色变暗
//        WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
//        lp.alpha = 0.7f;
//        getActivity().getWindow().setAttributes(lp);
//        mPopupWindow.setOnDismissListener(() -> {
//            WindowManager.LayoutParams lp1 = getActivity().getWindow().getAttributes();
//            lp1.alpha = 1f;
//            getActivity().getWindow().setAttributes(lp1);
//        });
    }
 
源代码11 项目: xposed-aweme   文件: AweMeHook.java
private LinearLayout newButtonView(final Dialog dialog,
                                   int imageRes, String desc, View.OnClickListener listener) {

    ImageView imageView = new ImageView(dialog.getContext());
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    Picasso.get().load(ResourceUtil.resourceIdToUri(
            BuildConfig.APPLICATION_ID, imageRes)).into(imageView);

    TextView textView = new TextView(dialog.getContext());
    textView.setText(desc);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(12);

    LinearLayout layout = new LinearLayout(dialog.getContext());
    layout.setGravity(Gravity.CENTER_HORIZONTAL);
    layout.setOrientation(LinearLayout.VERTICAL);

    int width = DisplayUtil.dip2px(dialog.getContext(), 48);
    int left = DisplayUtil.dip2px(dialog.getContext(), 6);
    int bottom = DisplayUtil.dip2px(dialog.getContext(), 15);
    int top = DisplayUtil.dip2px(dialog.getContext(), 6);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, width);
    params.setMargins(0, top, 0, bottom);

    layout.setPadding(left, 0, 0, 0);
    layout.addView(imageView, params);
    layout.addView(textView, LayoutUtil.newWrapLinearLayoutParams());

    layout.setOnClickListener(listener);

    return layout;
}
 
源代码12 项目: bither-android   文件: AddAddressHotHDMFragment.java
private void initView(View v) {
    flParent = (FrameLayout) v.findViewById(R.id.fl_parent);
    flContainer = (FrameLayout) v.findViewById(R.id.fl_container);
    vBg = (HDMTriangleBgView) v.findViewById(R.id.v_bg);
    llHot = (LinearLayout) v.findViewById(R.id.ll_hot);
    llCold = (LinearLayout) v.findViewById(R.id.ll_cold);
    llServer = (LinearLayout) v.findViewById(R.id.ll_server);
    ivHotLight = (ImageView) v.findViewById(R.id.iv_hot_light);
    ivColdLight = (ImageView) v.findViewById(R.id.iv_cold_light);
    ivServerLight = (ImageView) v.findViewById(R.id.iv_server_light);
    tvHot = (TextView) v.findViewById(R.id.tv_hot);
    tvCold = (TextView) v.findViewById(R.id.tv_cold);
    tvServer = (TextView) v.findViewById(R.id.tv_server);
    llSingular = (LinearLayout) v.findViewById(R.id.ll_singular);
    cbxSingular = (CheckBox) v.findViewById(R.id.cbx_singular);
    llSingularRunning = v.findViewById(R.id.ll_singular_running);
    v.findViewById(R.id.ibtn_info).setOnClickListener(DialogHDMInfo.ShowClick);
    v.findViewById(R.id.ibtn_singular_info).setOnClickListener(singularInfoClick);
    ViewGroup.LayoutParams lpContainer = flContainer.getLayoutParams();
    lpContainer.width = UIUtil.getScreenWidth();
    lpContainer.height = lpContainer.width - flContainer.getPaddingLeft() - flContainer
            .getPaddingRight() + flContainer.getPaddingTop() + flContainer.getPaddingBottom();
    flParent.getLayoutParams().width = lpContainer.width;
    flParent.getLayoutParams().height = lpContainer.height;

    llHot.setOnClickListener(hotClick);
    llCold.setOnClickListener(coldClick);
    llServer.setOnClickListener(serverClick);
    hdmHotAddWithAndroid = new HDMHotAddAndroid(getActivity(), this, this);

}
 
源代码13 项目: RecordVideo   文件: BaseDialog.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(mTag, "onCreate");
    mDisplayMetrics = mContext.getResources().getDisplayMetrics();
    mMaxHeight = mDisplayMetrics.heightPixels - StatusBarUtils.getHeight(mContext);
    // mMaxHeight = mDisplayMetrics.heightPixels;

    mLlTop = new LinearLayout(mContext);
    mLlTop.setGravity(Gravity.CENTER);

    mLlControlHeight = new LinearLayout(mContext);
    mLlControlHeight.setOrientation(LinearLayout.VERTICAL);

    mOnCreateView = onCreateView();
    mLlControlHeight.addView(mOnCreateView);
    mLlTop.addView(mLlControlHeight);
    onViewCreated(mOnCreateView);

    if (mIsPopupStyle) {
        setContentView(mLlTop, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        setContentView(mLlTop, new ViewGroup.LayoutParams(mDisplayMetrics.widthPixels, (int) mMaxHeight));
    }

    mLlTop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mCancel) {
                dismiss();
            }
        }
    });

    mOnCreateView.setClickable(true);
}
 
源代码14 项目: toktok-android   文件: MainActivityHolder.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final LinearLayout chatsDrawerItem = this.findViewById(R.id.home_drawer_chats);
    final LinearLayout profileDrawerItem = this.findViewById(R.id.home_drawer_profile);

    chatsDrawerItem.setOnClickListener(v -> activeTab = changeTab(activeTab, chatsDrawerItem, "Chats", "", (FragmentFactory) () -> new MainFragment()));

    profileDrawerItem.setOnClickListener(v -> activeTab = changeTab(activeTab, profileDrawerItem, "Profile", "Activity", (FragmentFactory) () -> new ProfileFragment()));

    chatsDrawerItem.callOnClick();
}
 
源代码15 项目: SmallGdufe-Android   文件: ScheduleView.java
/**
     * 获取单个课表View
     *
     * @param model 数据类型
     * @return
     */
    @SuppressWarnings("deprecation")
    private View getMode(final Schedule model) {
        LinearLayout mScheduleView = new LinearLayout(getContext());
        mScheduleView.setOrientation(VERTICAL);
        TextView mTimeTableNameView = new TextView(getContext());
        int num = model.getEndSec() - model.getStartSec();
        mTimeTableNameView.setHeight(dip2px((num + 1) * TimeTableHeight) + num * 2);
        mTimeTableNameView.setTextColor(getContext().getResources().getColor(
                android.R.color.white));
        mTimeTableNameView.setWidth(dip2px(50));
        mTimeTableNameView.setTextSize(CourseTextSize);
        mTimeTableNameView.setGravity(Gravity.CENTER);
        mTimeTableNameView.setText(model.getName() + "\n" + model.getLocation());
        mScheduleView.addView(mTimeTableNameView);
        mScheduleView.addView(getWeekTransverseLine());
        mScheduleView.setBackgroundDrawable(getContext().getResources()
                .getDrawable(colors[getColorNum(model.getName())]));

        if(mCurrentWeek != FileUtils.SP_WEEK_NOT_SET && !CalcUtils.isCurrentWeek(model.getPeriod(), mCurrentWeek)){
            mScheduleView.setBackgroundDrawable(getContext().getResources()
                    .getDrawable(notGocolors));
//            mTimeTableNameView.setTextColor(getContext().getResources().getColor(
//                    android.R.color.darker_gray));
        }

        mScheduleView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
//                Toast.makeText(getContext(), model.getName() + "\n" + model.getLocation()+"\n" +model.getPeriod()+"\n"+ model.getTeacher(), Toast.LENGTH_SHORT).show();
                //TODO 编辑课程
                mClickListener.onClickScheduleEdit(model);
            }
        });
        return mScheduleView;
    }
 
源代码16 项目: Huochexing12306   文件: AboutAty.java
private void initViews() {
	TextView tvInfo1 = (TextView)findViewById(R.id.info);
	memberLayout = (LinearLayout)findViewById(R.id.about_memberLayout);
	teamLogo = (ImageView)findViewById(R.id.about_teamLogo);
	btnEmail = (Button)findViewById(R.id.email);
	btnEmail.setOnClickListener(this);
	btnQQ = (Button)findViewById(R.id.about_btnQQ);
	btnQQ.setOnClickListener(this);
	llytSinaWeibo = (LinearLayout)findViewById(R.id.about_llytSinaWeiBo);
	llytSinaWeibo.setOnClickListener(this);
	tvSinaWeibo = (TextView)findViewById(R.id.about_sinaWeiBo);
	
	String strInfo1 = "应用版本:V"+MyUtils.getVersionName(this);
	tvInfo1.setText(Html.fromHtml(strInfo1));
	String strEmail = "[email protected]";
	btnEmail.setText(Html.fromHtml("<u>联系邮箱: "+strEmail+"</u>"));
	btnEmail.setTag(strEmail);
	btnQQ.setText(Html.fromHtml("<u>" + strQQ + "</u>"));
	tvSinaWeibo.setText(Html.fromHtml("<u>@"+strSinaWeibo+"</u>"));
	teamLogo.setOnLongClickListener(new View.OnLongClickListener() {
		@Override
		public boolean onLongClick(View v) {
			memberLayout.setVisibility(memberLayout.isShown() ? View.GONE : View.VISIBLE);
			return false;
		}
	});
}
 
源代码17 项目: o2oa   文件: DocumentAdapter.java
@Override
public View getView(final int position, View convertView, ViewGroup viewGroup) {
    final FileItem item = mList.get(position);
    if (null == convertView) {
        convertView = mInflater.inflate(R.layout.item_document, null);
    }
    LinearLayout itemLl = ViewHolder.get(convertView, R.id.document_item_ll);
    final CheckBox checkBox = ViewHolder.get(convertView, R.id.document_cb);
    TextView title = ViewHolder.get(convertView, R.id.document_title);
    TextView size = ViewHolder.get(convertView, R.id.document_size);
    TextView date = ViewHolder.get(convertView, R.id.document_date);

    itemLl.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (checkBox.isChecked()) {
                checkBox.setChecked(false);
                mSelectMap.delete(position);
                mListener.onUnselected(item.getFilePath(), item.getLongFileSize(), FileType.document);
            } else {
                if (mFragment.getTotalCount() < 5) {
                    if (mFragment.getTotalSize() + item.getLongFileSize() < 10485760.0) {
                        checkBox.setChecked(true);
                        mSelectMap.put(position, true);
                        mListener.onSelected(item.getFilePath(), item.getLongFileSize(), FileType.document);
                        addAnimation(checkBox);
                    } else {
                        Toast.makeText(mFragment.getContext(), mFragment.getString(R.string
                                .file_size_over_limit_hint), Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(mFragment.getContext(), mFragment.getString(R.string
                            .size_over_limit_hint), Toast.LENGTH_SHORT).show();
                }
            }
        }
    });

    checkBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (checkBox.isChecked()) {
                if (mFragment.getTotalCount() < 5) {
                    if (mFragment.getTotalSize() + item.getLongFileSize() < 10485760.0) {
                        checkBox.setChecked(true);
                        mSelectMap.put(position, true);
                        mListener.onSelected(item.getFilePath(), item.getLongFileSize(), FileType.document);
                        addAnimation(checkBox);
                    } else {
                        checkBox.setChecked(false);
                        Toast.makeText(mFragment.getContext(), mFragment.getString(R.string
                                .file_size_over_limit_hint), Toast.LENGTH_SHORT).show();
                    }
                } else {
                    checkBox.setChecked(false);
                    Toast.makeText(mFragment.getContext(), mFragment.getString(R.string
                            .size_over_limit_hint), Toast.LENGTH_SHORT).show();
                }
            } else {
                mSelectMap.delete(position);
                mListener.onUnselected(item.getFilePath(), item.getLongFileSize(), FileType.document);
            }
        }
    });

    checkBox.setChecked(mSelectMap.get(position));
    String path = item.getFilePath();
    title.setText(path.substring(path.lastIndexOf('/') + 1));
    size.setText(item.getFileSize());
    date.setText(item.getDate());
    return convertView;
}
 
private void init() {
	// TODO Auto-generated method stub
	iv_avatar = (SmartImageView) findViewById(R.id.iv_avatar);
	tv_username = (TextView) findViewById(R.id.tv_username);
	lv_topics = (LinearLayout) findViewById(R.id.lv_topics);
	lv_topics.setOnClickListener(this);
	tv_topic = (TextView) findViewById(R.id.tv_topic);
	lv_ifocus_person = (LinearLayout) findViewById(R.id.lv_ifocus_person);
	lv_ifocus_person.setOnClickListener(this);
	tv_ifocus_person = (TextView) findViewById(R.id.tv_ifocus_person);
	lv_focusi_person = (LinearLayout) findViewById(R.id.lv_focusi_person);
	lv_focusi_person.setOnClickListener(this);
	tv_focusi_person = (TextView) findViewById(R.id.tv_focusi_person);

	tv_thanks = (TextView) findViewById(R.id.tv_thanks);
	tv_votes = (TextView) findViewById(R.id.tv_votes);
	tv_collect = (TextView) findViewById(R.id.tv_collect);

	lv_replys = (LinearLayout) findViewById(R.id.lv_replys);
	lv_replys.setOnClickListener(this);
	tv_replys = (TextView) findViewById(R.id.tv_replys);
	lv_asks = (LinearLayout) findViewById(R.id.lv_asks);
	lv_asks.setOnClickListener(this);
	tv_asks = (TextView) findViewById(R.id.tv_asks);
	lv_articles = (LinearLayout) findViewById(R.id.lv_articles);
	lv_articles.setOnClickListener(this);

	lv_news = (LinearLayout) findViewById(R.id.lv_news);
	lv_news.setOnClickListener(this);

	lv_search_friens = (LinearLayout) findViewById(R.id.lv_search_friens);
	lv_search_friens.setOnClickListener(this);

	bt_focus = (Button) findViewById(R.id.bt_focus);
	bt_focus.setOnClickListener(this);
	tv_focusi_person_comment = (TextView) findViewById(R.id.tv_focusi_person_comment);
	tv_ifocus_person_comment = (TextView) findViewById(R.id.tv_ifocus_person_comment);
	tv_topic_comment = (TextView) findViewById(R.id.tv_topic_comment);
	tvSignature = (TextView) findViewById(R.id.tvSignature);
	pb_change_follow = (ProgressBar) findViewById(R.id.pb_change_follow);
	ll_logout = (LinearLayout) findViewById(R.id.ll_logout);
	ll_logout.setOnClickListener(this);
	// �жϱ������ѵ�¼�û�������ǿ��Ա༭�����ع�ע��ť���������ر༭��ť��ʾ��ע��ť��
	if (status == GlobalVariables.AVAILABLE_EDIT) {
		bt_focus.setVisibility(View.INVISIBLE);
		ll_logout.setVisibility(View.VISIBLE);
	} else {
		ll_logout.setVisibility(View.GONE);
		tv_focusi_person_comment.setText("��ע������");
		tv_ifocus_person_comment.setText("����ע����");
		tv_topic_comment.setText("����ע�Ļ���");
	}
	if (haveFrocus == YES) {
		bt_focus.setBackgroundResource(R.drawable.btn_silver_normal);
		bt_focus.setTextColor(android.graphics.Color.BLACK);
		bt_focus.setText("ȡ����ע");
	}
}
 
源代码19 项目: frost   文件: LicenseActivity.java
private void createLayout() {
    LinearLayout.LayoutParams smallLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f);
    float scale = ScreenUtils.densityScale(getApplicationContext());
    int padding = Math.round(64 * scale);

    LinearLayout frameLayout = new LinearLayout(this);
    frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    frameLayout.setBackgroundColor(getResources().getColor(R.color.colorLight));
    frameLayout.setGravity(Gravity.CENTER);
    setContentView(frameLayout);

    LinearLayout baseLayout = new LinearLayout(this);
    baseLayout.setOrientation(LinearLayout.VERTICAL);
    baseLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
    baseLayout.setGravity(Gravity.START);
    frameLayout.addView(baseLayout);

    // code
    LinearLayout sourceLayout = new LinearLayout(this);
    sourceLayout.setOrientation(LinearLayout.HORIZONTAL);
    sourceLayout.setLayoutParams(smallLayoutParams);
    sourceLayout.setGravity(Gravity.CENTER);
    baseLayout.addView(sourceLayout);

    LinearLayout sourceClickLayout = new LinearLayout(this);
    sourceClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    sourceClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    sourceClickLayout.setGravity(Gravity.CENTER);
    sourceLayout.addView(sourceClickLayout);
    sourceClickLayout.setOnClickListener(this::gplLink);

    TextView sourceText = new TextView(this);
    sourceText.setText(getResources().getString(R.string.description_code));
    sourceText.setTextSize(24);
    sourceText.setTextColor(getResources().getColor(R.color.textLight));
    sourceText.setPadding(padding, padding, padding, padding);
    sourceClickLayout.addView(sourceText);

    // images
    LinearLayout imgLayout = new LinearLayout(this);
    imgLayout.setOrientation(LinearLayout.HORIZONTAL);
    imgLayout.setLayoutParams(smallLayoutParams);
    imgLayout.setGravity(Gravity.CENTER);
    imgLayout.setBackgroundColor(getResources().getColor(R.color.colorAccent));
    baseLayout.addView(imgLayout);

    LinearLayout imgClickLayout = new LinearLayout(this);
    imgClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    imgClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    imgClickLayout.setGravity(Gravity.CENTER);
    imgLayout.addView(imgClickLayout);
    imgClickLayout.setOnClickListener(this::ccLink);

    TextView imgText = new TextView(this);
    imgText.setText(getResources().getString(R.string.description_images));
    imgText.setTextSize(24);
    imgText.setTextColor(getResources().getColor(R.color.textDark));
    imgText.setPadding(padding, padding, padding, padding);
    imgClickLayout.addView(imgText);
}
 
源代码20 项目: onpc   文件: DeviceFragment.java
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    initializeFragment(inflater, container, R.layout.device_fragment);

    // Friendly name
    {
        friendlyName = rootView.findViewById(R.id.device_edit_friendly_name);
        final AppCompatImageButton b = rootView.findViewById(R.id.device_change_friendly_name);
        prepareButtonListeners(b, null, () ->
        {
            if (activity.isConnected())
            {
                activity.getStateManager().sendMessage(
                        new FriendlyNameMsg(friendlyName.getText().toString()));
                // #119: Improve clearing focus for friendly name edit field
                friendlyName.clearFocus();
            }
        });
        setButtonEnabled(b, true);

        // #119: Improve clearing focus for friendly name edit field
        // OnClick for background layout: clear focus for friendly name text field
        {
            LinearLayout l = rootView.findViewById(R.id.device_background_layout);
            l.setClickable(true);
            l.setEnabled(true);
            l.setOnClickListener((v) -> friendlyName.clearFocus());
        }
    }

    prepareImageButton(R.id.btn_firmware_update, new FirmwareUpdateMsg(FirmwareUpdateMsg.Status.NET));
    prepareImageButton(R.id.device_dimmer_level_toggle, new DimmerLevelMsg(DimmerLevelMsg.Level.TOGGLE));
    prepareImageButton(R.id.device_digital_filter_toggle, new DigitalFilterMsg(DigitalFilterMsg.Filter.TOGGLE));
    prepareImageButton(R.id.music_optimizer_toggle, new MusicOptimizerMsg(MusicOptimizerMsg.Status.TOGGLE));
    prepareImageButton(R.id.device_auto_power_toggle, new AutoPowerMsg(AutoPowerMsg.Status.TOGGLE));
    prepareImageButton(R.id.hdmi_cec_toggle, new HdmiCecMsg(HdmiCecMsg.Status.TOGGLE));
    prepareImageButton(R.id.phase_matching_bass_toggle, new PhaseMatchingBassMsg(PhaseMatchingBassMsg.Status.TOGGLE));
    prepareImageButton(R.id.sleep_time_toggle, null);
    prepareImageButton(R.id.speaker_ab_command_toggle, null);
    prepareImageButton(R.id.google_cast_analytics_toggle, null);

    updateContent();
    return rootView;
}