Java Code Examples for android.widget.LinearLayout#findViewById()
The following examples show how to use
android.widget.LinearLayout#findViewById() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttentionUserFrament.java From WeCenterMobile-Android with GNU General Public License v2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.attention_listview, container, false); Intent intent = getActivity().getIntent(); String UserOrMe = intent.getStringExtra("userorme"); uid = intent.getStringExtra("uid"); if (UserOrMe.equals(GlobalVariables.ATTENEION_ME)) { url = Config.getValue("AttentionMe"); }else { url = Config.getValue("AttentionUser"); } attentionUserModels = new ArrayList<AttentionUserModel>(); imageDownLoader = new ImageDownLoader(getActivity()); footerLinearLayout = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.next_page_footer,null); footText = (TextView)footerLinearLayout.findViewById(R.id.footer_text); isFirstEnter = true; init(view); getInformation("1"); return view; }
Example 2
Source File: FileChooserCore.java From smartcoins-wallet with MIT License | 6 votes |
/** * Changes the height of the layout for the buttons, according if the buttons are visible or not. */ private void updateButtonsLayout() { // Get the buttons layout. LinearLayout root = this.chooser.getRootLayout(); // Verify if the 'Add' button is visible or not. View addButton = root.findViewById(R.id.buttonAdd); addButton.setVisibility(this.canCreateFiles? View.VISIBLE : View.GONE); // Verify if the 'Ok' button is visible or not. View okButton = root.findViewById(R.id.buttonOk); okButton.setVisibility(this.folderMode? View.VISIBLE : View.GONE); // Verify if the 'Cancel' button is visible or not. View cancelButton = root.findViewById(R.id.buttonCancel); cancelButton.setVisibility(this.showCancelButton? View.VISIBLE : View.GONE); }
Example 3
Source File: SpareClassroomsFragment.java From PKUCourses with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_spare_classrooms, container, false); // 查找xml文件中的对象并保存进Java变量 mSpareClassroomsSwipeContainer = linearLayout.findViewById(R.id.spare_classrooms_swipe_container); mWebView = linearLayout.findViewById(R.id.spare_classrooms_web_view); mSpareClassroomsSwipeContainer.setOnRefreshListener(this); mSpareClassroomsSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent)); // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new SpareClassroomsLoadingTask(); mLoadingTask.execute((Void) null); return linearLayout; }
Example 4
Source File: FilePicker.java From MyBookshelf with GNU General Public License v3.0 | 6 votes |
@Override @NonNull protected LinearLayout makeCenterView() { @SuppressLint("InflateParams") LinearLayout rootLayout = (LinearLayout) LayoutInflater.from(activity).inflate(R.layout.view_file_picker, null); RecyclerView recyclerView = rootLayout.findViewById(R.id.rv_file); recyclerView.addItemDecoration(new DividerItemDecoration(activity, LinearLayout.VERTICAL)); recyclerView.setLayoutManager(new LinearLayoutManager(activity)); recyclerView.setAdapter(adapter); emptyView = rootLayout.findViewById(R.id.tv_empty); RecyclerView pathView = rootLayout.findViewById(R.id.rv_path); pathView.setLayoutManager(new LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)); pathView.setAdapter(pathAdapter); return rootLayout; }
Example 5
Source File: CustomizedChineseSuggestStripView.java From Android-Keyboard with Apache License 2.0 | 6 votes |
@Override public Object instantiateItem(final ViewGroup container, final int position) { LinearLayout viewItem = (LinearLayout) LayoutInflater.from(container.getContext()).inflate( R.layout.customized_chinesed_suggest_view_item, container, false /* attachToRoot */); for (int i = 0 ; i < 3 ; i ++) { int index = position * 3 + i; String s = (index >= data.size()) ? "" : data.get(index); TextView item = (i == 0) ? viewItem.findViewById(R.id.item1) : (i == 1) ? viewItem.findViewById(R.id.item2) : viewItem.findViewById(R.id.item3); item.setText(s); item.setOnClickListener(v -> { if (!s.equals("")) { mChineseSuggestStripViewListener.pickSuggestionManually(index); } }); } container.addView(viewItem); return viewItem; }
Example 6
Source File: StarkSpinner.java From SSForms with GNU General Public License v3.0 | 6 votes |
public StarkSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mContext = context; getAttributeSet(attrs, defStyleAttr, defStyleRes); final LayoutInflater factory = LayoutInflater.from(context); factory.inflate(R.layout.view_stark_spinner, this, true); mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false); mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView); if (mListItemDivider != null) { mSpinnerListView.setDivider(mListItemDivider); mSpinnerListView.setDividerHeight(mListDividerSize); } mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText); mSpinnerListView.setEmptyView(mEmptyTextView); }
Example 7
Source File: CallActivity.java From Linphone4Android with GNU General Public License v3.0 | 6 votes |
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) { boolean isCallPaused, isInConference; ImageView callState = (ImageView) callView.findViewById(R.id.call_pause); callState.setTag(call); callState.setOnClickListener(this); if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) { callState.setImageResource(R.drawable.pause); isCallPaused = true; isInConference = false; } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) { isCallPaused = false; isInConference = false; } else { isInConference = isConferenceRunning && call.isInConference(); isCallPaused = false; } return isCallPaused || isInConference; }
Example 8
Source File: RecorderDialogManager.java From PlayTogether with Apache License 2.0 | 5 votes |
public RecorderDialogManager(Context context) { mContext = context; mDialog = new Dialog(mContext, R.style.Theme_AudioDialog); mInflater = LayoutInflater.from(mContext); mLlContainer = (LinearLayout) mInflater.inflate(R.layout.dialog_recorder, null); mDialog.setContentView(mLlContainer); mIvRecorder = (ImageView) mLlContainer.findViewById(R.id.iv_recoder); mIvVoiceLevel = (ImageView) mLlContainer.findViewById(R.id.iv_voice_level); mTvText = (TextView) mLlContainer.findViewById(R.id.tv_text); }
Example 9
Source File: FunnyFragment.java From wakao-app with MIT License | 5 votes |
@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; }
Example 10
Source File: RepoHandlerAdapter.java From Stringlate with MIT License | 5 votes |
ViewHolder(final LinearLayout root) { super(root); this.root = root; repositoryLayout = root.findViewById(R.id.repositoryLayout); iconView = root.findViewById(R.id.repositoryIcon); pathTextView = root.findViewById(R.id.repositoryPath); hostTextView = root.findViewById(R.id.repositoryHost); translatedProgressTextView = root.findViewById(R.id.translatedProgressText); translatedProgressBar = root.findViewById(R.id.translatedProgressBar); separatorTextView = root.findViewById(R.id.separatorTextView); }
Example 11
Source File: RangeSelector.java From NClientV2 with Apache License 2.0 | 5 votes |
private void applyLogic(LinearLayout layout, boolean start) { ImageButton prev=layout.findViewById(R.id.prev); ImageButton next=layout.findViewById(R.id.next); TextView pages=layout.findViewById(R.id.pages); SeekBar seekBar =layout.findViewById(R.id.seekBar); prev.setOnClickListener(getPrevListener(seekBar)); next.setOnClickListener(getNextListener(seekBar)); seekBar.setMax(gallery.getPageCount()-1); seekBar.setOnSeekBarChangeListener(getSeekBarListener(pages)); seekBar.setProgress(1); seekBar.setProgress(start?0:gallery.getPageCount()); if(start)s1=seekBar; else s2=seekBar; }
Example 12
Source File: KcaEquipListViewAdpater.java From kcanotify_h5-master with GNU General Public License v3.0 | 5 votes |
private LinearLayout getEquipmentShipDetailView(Context context, LayoutInflater inflater, LinearLayout root, int lv, int alv, String key, boolean is_aircraft) { LinearLayout ship_equip_item = (LinearLayout)inflater.inflate(R.layout.listview_equipment_count, root, false); TextView ship_equip_item_lv = ship_equip_item.findViewById(R.id.equipment_lv); TextView ship_equip_item_alv = ship_equip_item.findViewById(R.id.equipment_alv); TextView ship_equip_item_ships = ship_equip_item.findViewById(R.id.equipment_ships); TextView ship_equip_item_cnt_sum = ship_equip_item.findViewById(R.id.equipment_cnt_sum); JsonObject ship_equip_detail = getEquipmentShipDetail(key); ship_equip_item_lv.setText(getLvText(lv)); if (lv == 0) ship_equip_item_lv.setTextColor(ContextCompat.getColor(context, R.color.grey)); else ship_equip_item_lv.setTextColor(ContextCompat.getColor(context, R.color.itemlevel)); if (is_aircraft) { ship_equip_item_alv.setVisibility(View.VISIBLE); ship_equip_item_alv.setText(getAlvText(alv)); if (alv < 0) ship_equip_item_alv.setTextColor(ContextCompat.getColor(context, R.color.grey)); else if (alv < 4) ship_equip_item_alv.setTextColor(ContextCompat.getColor(context, R.color.itemalv1)); else ship_equip_item_alv.setTextColor(ContextCompat.getColor(context, R.color.itemalv2)); } else { ship_equip_item_alv.setVisibility(View.GONE); ship_equip_item_alv.setText(""); } int item_count = countInfo.get(key).get(); int item_equip_count = ship_equip_detail.get("count").getAsInt(); ship_equip_item_cnt_sum.setText(KcaUtils.format(summary_format, item_count, item_equip_count, item_count - item_equip_count)); ship_equip_item_ships.setText(ship_equip_detail.get("ship").getAsString()); return ship_equip_item; }
Example 13
Source File: ColorPickerView.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
private void setColorPreviewColor(int newColor) { if (colorPreview == null || initialColors == null || colorSelection > initialColors.length || initialColors[colorSelection] == null) return; int children = colorPreview.getChildCount(); if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return; View childView = colorPreview.getChildAt(colorSelection); if (!(childView instanceof LinearLayout)) return; LinearLayout childLayout = (LinearLayout) childView; ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview); childImage.setImageDrawable(new CircleColorDrawable(newColor)); }
Example 14
Source File: MultiColumnPullToRefreshListView.java From EverMemo with MIT License | 5 votes |
private void init(){ setVerticalFadingEdgeEnabled(false); headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null); header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header); text = (TextView) header.findViewById(R.id.ptr_id_text); lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated); image = (ImageView) header.findViewById(R.id.ptr_id_image); spinner = (ProgressBar) header.findViewById(R.id.ptr_id_spinner); pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh); releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh); refreshingText = getContext().getString(R.string.ptr_refreshing); lastUpdatedText = getContext().getString(R.string.ptr_last_updated); flipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); flipAnimation.setInterpolator(new LinearInterpolator()); flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); flipAnimation.setFillAfter(true); reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseFlipAnimation.setInterpolator(new LinearInterpolator()); reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); reverseFlipAnimation.setFillAfter(true); addHeaderView(headerContainer); setState(State.PULL_TO_REFRESH); scrollbarEnabled = isVerticalScrollBarEnabled(); ViewTreeObserver vto = header.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener()); //super.setOnItemClickListener(new PTROnItemClickListener()); //super.setOnItemLongClickListener(new PTROnItemLongClickListener()); }
Example 15
Source File: ColorPickerView.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) { if (colorPreview == null) return; this.colorPreview = colorPreview; if (selectedColor == null) selectedColor = 0; int children = colorPreview.getChildCount(); if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return; for (int i = 0; i < children; i++) { View childView = colorPreview.getChildAt(i); if (!(childView instanceof LinearLayout)) continue; LinearLayout childLayout = (LinearLayout) childView; if (i == selectedColor) { childLayout.setBackgroundColor(Color.WHITE); } ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview); childImage.setClickable(true); childImage.setTag(i); childImage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v == null) return; Object tag = v.getTag(); if (tag == null || !(tag instanceof Integer)) return; setSelectedColor((int) tag); } }); } }
Example 16
Source File: PickerAlbumPreviewActivity.java From NIM_Android_UIKit with MIT License | 5 votes |
public void updateCurrentImageView(final int position) { if (photoLists == null || (position > 0 && position >= photoLists.size())) return; if (currentPosition == position) { return; } else { currentPosition = position; } LinearLayout currentLayout = imageViewPager.findViewWithTag(position); if (currentLayout == null) { Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { @Override public void run() { updateCurrentImageView(position); } }, 300); return; } currentImageView = (BaseZoomableImageView) currentLayout.findViewById(R.id.imageView); currentImageView.setViewPager(imageViewPager); setImageView(photoLists.get(position)); }
Example 17
Source File: DeviceDetailActivity.java From BLE with Apache License 2.0 | 5 votes |
/** * 追加设备基础信息 * * @param adapter * @param device */ private void appendDeviceInfo(final MergeAdapter adapter, final BluetoothLeDevice device) { final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_device_info, null); final TextView tvName = (TextView) lt.findViewById(R.id.deviceName); final TextView tvAddress = (TextView) lt.findViewById(R.id.deviceAddress); final TextView tvClass = (TextView) lt.findViewById(R.id.deviceClass); final TextView tvMajorClass = (TextView) lt.findViewById(R.id.deviceMajorClass); final TextView tvServices = (TextView) lt.findViewById(R.id.deviceServiceList); final TextView tvBondingState = (TextView) lt.findViewById(R.id.deviceBondingState); tvName.setText(device.getName()); tvAddress.setText(device.getAddress()); tvClass.setText(device.getBluetoothDeviceClassName()); tvMajorClass.setText(device.getBluetoothDeviceMajorClassName()); tvBondingState.setText(device.getBluetoothDeviceBondState()); final String supportedServices; if (device.getBluetoothDeviceKnownSupportedServices().isEmpty()) { supportedServices = getString(R.string.no_known_services); } else { final StringBuilder sb = new StringBuilder(); for (final BluetoothServiceType service : device.getBluetoothDeviceKnownSupportedServices()) { if (sb.length() > 0) { sb.append(", "); } sb.append(service); } supportedServices = sb.toString(); } tvServices.setText(supportedServices); adapter.addView(lt); }
Example 18
Source File: MonthGridView.java From CustomizableCalendar with MIT License | 4 votes |
private void bindViews() { LinearLayout calendarLayout = (LinearLayout) LayoutInflater.from(getContext()).inflate(layoutResId, this); calendarGrid = (GridView) calendarLayout.findViewById(android.R.id.widget_frame); }
Example 19
Source File: SlickForm.java From SlickForm with MIT License | 4 votes |
/** * Method that initializes this custom view's default values and sets listeners * * @param context The context used to create this view * @param attrs The attributes used to initialize fields */ private void initAttrs(final Context context, final AttributeSet attrs) { if (isInEditMode()) return; final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SlickForm); try { mContext = context; slickButtonForegroundColor = typedArray.getColor(R.styleable.SlickForm_slick_buttonFgColor, context.getResources().getColor(R.color.colorWhite)); slickButtonBackgroundColor = typedArray.getColor(R.styleable.SlickForm_slick_buttonBgColor, context.getResources().getColor(R.color.colorPurple)); isTooltipEnabled = typedArray.getBoolean(R.styleable.SlickForm_slick_tooltipEnabled, true); LinearLayout mRootView = (LinearLayout) inflate(context, R.layout.library_main_layout, this); slickFieldContainer = (RelativeLayout) mRootView.findViewById(R.id.slick_form_field_container); slickFormProgressBar = (ProgressBar) mRootView.findViewById(R.id.slick_form_progress); slickSVGIcon = (PathView) mRootView.findViewById(R.id.svgIcon); slickEndAnimationContainer = (RelativeLayout) mRootView.findViewById(R.id.slick_form_end_anim_container); slickEndAnimationProgressBar = (ProgressBar) mRootView.findViewById(R.id.slick_form_end_progress_bar); slickFormSubmitButton = (Button) mRootView.findViewById(R.id.slick_form_submit_button); slickFormSubmitButton.setBackgroundColor(slickButtonBackgroundColor); slickFormSubmitButton.setTextColor(slickButtonForegroundColor); slickFormSubmitButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(currentFieldPosition >= formFields.size()) { return; } processFormState(); } }); } finally { typedArray.recycle(); } }
Example 20
Source File: FragmentPage3.java From quickmark with MIT License | 4 votes |
@SuppressWarnings("unchecked") @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // 获取二级列表对应的布局文件, 并将其各元素设置相应的属性 LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate( R.layout.list, null); RelativeLayout search_img2 = (RelativeLayout) linearLayout .findViewById(R.id.search_img2); RelativeLayout titlebar = (RelativeLayout) linearLayout .findViewById(R.id.titlebar); ImageView search_img = (ImageView) linearLayout .findViewById(R.id.search_img); TextView search_date = (TextView) linearLayout .findViewById(R.id.search_date); TextView search_date2 = (TextView) linearLayout .findViewById(R.id.search_date2); TextView no = (TextView) linearLayout.findViewById(R.id.no); TextView kind = (TextView) linearLayout.findViewById(R.id.kind); TextView title = (TextView) linearLayout.findViewById(R.id.title); TextView money = (TextView) linearLayout.findViewById(R.id.money); titlebar.setVisibility(View.GONE); search_img2.setVisibility(View.VISIBLE); title.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("title")); no.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("no")); kind.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("kind")); money.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("money")); search_date2.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("date")); search_date.setText(((Map<String, String>) getChild(groupPosition, childPosition)).get("info").substring(8, 10)); search_img.setImageResource(Integer .parseInt(((Map<String, String>) getChild(groupPosition, childPosition)).get("img"))); if (((Map<String, String>) getChild(groupPosition, childPosition)) .get("kind").equals("[收入]")) { money.setTextColor(Color.parseColor("#ffff0000")); } else { money.setTextColor(Color.parseColor("#5ea98d")); } return linearLayout; }