本文整理汇总了Java中android.view.View.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java View.findViewById方法的具体用法?Java View.findViewById怎么用?Java View.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.findViewById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ProgrammedLocationBasedTaskViewHolder
import android.view.View; //导入方法依赖的package包/类
public ProgrammedLocationBasedTaskViewHolder(View itemView, ViewHolderClickListener listener) {
super(itemView);
mClickListener = listener;
mContainer = (RelativeLayout) itemView.findViewById(R.id.item_task_programmed_location_based_container);
mCategoryIcon = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_category_icon);
mAttachmentList = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_list);
mAttachmentLink = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_link);
mAttachmentAudio = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_audio);
mAttachmentImage = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_image);
mAttachmentText = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_text);
mTitle = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_title);
mDescription = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_description);
mLocation = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_location);
mItemDecoration = itemView.findViewById(R.id.item_task_programmed_location_item_decoration);
}
示例2: setView
import android.view.View; //导入方法依赖的package包/类
@Override
public void setView(View view) {
super.setView(view);
operateur = (TextView) view.findViewById(R.id.operateur);
maListe = (ListView) view.findViewById(R.id.liste_systemes);
//On utilise notre classe adapter à qui on envoie la liste que l'on souhaite traiter
OperatorAdapter sup_adapter = new OperatorAdapter(getContext() , this.operateurs);
// operateur.setText(tv_operateur);
if(operateurs.size() == 0)
{
operateur.setText("Non renseigné");
}
else
{
operateur.setText("Liste des opérateurs");
}
maListe.setAdapter(sup_adapter);
}
示例3: VerticalRecyclerViewHolder
import android.view.View; //导入方法依赖的package包/类
public VerticalRecyclerViewHolder(View view) {
super(view);
time = (TextView) view.findViewById(R.id.tv_timeline_time);
header = (TextView) view.findViewById(R.id.tv_timeline_header);
header.setVisibility(View.INVISIBLE);
timelineindicator_container = (RelativeLayout) view.findViewById(R.id.container_timeline_indicator);
timelineindicator_line = (TextView) view.findViewById(R.id.tv_timeline_indicator_line);
/*apply configs*/
time.setTextColor(Color.parseColor(TimeLineConfig.getTimelineHeaderTextColour()));
time.setTextSize(TimeLineConfig.getTimelineHeaderSize());
timelineindicator_line.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorLineColour()));
timelineindicator_container.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorBackgroundColour()));
recyclerView = (RecyclerView) view.findViewById(R.id.rv_horizontal_timeline);
LinearLayoutManager recyclerViewLayoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(recyclerViewLayoutManager);
LinearLayoutManager horizontalLinearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
recyclerView.setLayoutManager(horizontalLinearLayoutManager);
}
示例4: applyAgenda
import android.view.View; //导入方法依赖的package包/类
private void applyAgenda(View view) {
agendaAppointmentSet.clear();
String currDate = DateUtilities.Backport.GetCurrentDate();
for (BackportAppointment a : TimetableManager.getInstance().getGlobalsAsList()) {
if (a.getDate().equals(currDate)) {
agendaAppointmentSet.add(new AgendaAppointment(a.getStartTime(), a.getEndTime(), a.getTitle(), a.getPersons(), a.getResources(), false));
}
}
int size = agendaAppointmentSet.size();
TextView placeholder = view.findViewById(R.id.agendaEmptyPlaceholder);
if (size > 0) {
placeholder.setText("");
LinkedHashSet<AgendaAppointment> appointmentsWithBreaks = new LinkedHashSet<>();
Object[] agendaAppointmentArray = agendaAppointmentSet.toArray();
for (int i = 0; i < size; i++) {
AgendaAppointment aa = (AgendaAppointment) agendaAppointmentArray[i];
appointmentsWithBreaks.add(aa);
if (i < size - 1) {
AgendaAppointment following = (AgendaAppointment) agendaAppointmentArray[i + 1];
// If break is present
if (!aa.getEndTime().equals(following.getStartTime())) {
appointmentsWithBreaks.add(new AgendaAppointment(aa.getEndTime(), "DONOTUSE", "BREAK", "DONOTUSE", "DONOTUSE", true));
}
}
}
agendaAppointmentSet.clear();
agendaAppointmentSet.addAll(appointmentsWithBreaks);
String endTime = ((AgendaAppointment) agendaAppointmentArray[agendaAppointmentArray.length - 1]).getEndTime();
agendaAppointmentSet.add(new AgendaAppointment(endTime, "", "END", "DONOTUSE", "DONOTUSE", true));
aAdapter.notifyDataSetChanged();
} else {
placeholder.setText("No appointments");
}
}
示例5: onCreateView
import android.view.View; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
PostAdapter.PostAdapterCallback mPostLoadingListener = new PostAdapter.PostAdapterCallback() {
@Override
public void onPostImageLoadingError(String error, Exception e) {
mPresenter.onLoadPostImageError(error, e);
}
};
mPostAdapter = new PostAdapter(getContext(), mPostLoadingListener);
// Inflate the layout for this fragment
View layout = inflater.inflate(R.layout.fragment_main, container, false);
mProgressBar = (ProgressBar) layout.findViewById(R.id.progressBar);
mLayout = (CoordinatorLayout) layout.findViewById(R.id.layout_coordinator);
mPostList = (RecyclerView) layout.findViewById(R.id.post_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mPostList.setLayoutManager(layoutManager);
mPostList.setAdapter(mPostAdapter);
layout.findViewById(R.id.load_posts).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLoadPostsClick();
}
});
//TODO: Remove - for testing only:
onLoadPostsClick();
return layout;
}
示例6: DataViewHolder
import android.view.View; //导入方法依赖的package包/类
DataViewHolder(View itemView) {
super(itemView);
// textView = (TextView) itemView.findViewById(R.id.tv2);
// textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
imageView = (ImageView) itemView.findViewById(R.id.iv1);
imageView.setOnClickListener(this);
}
示例7: initViews
import android.view.View; //导入方法依赖的package包/类
private void initViews(View mView) {
mNewVersionView = (ImageView) mView.findViewById(R.id.new_version_icon);
imageView = (SelectableRoundedImageView) mView.findViewById(R.id.mine_header);
mName = (TextView) mView.findViewById(R.id.mine_name);
//头像和name条目
LinearLayout mUserProfile = (LinearLayout) mView.findViewById(R.id.start_user_profile);
//账号设置条目
LinearLayout mMineSetting = (LinearLayout) mView.findViewById(R.id.mine_setting);
//我的红包条目
LinearLayout mMinWallet = (LinearLayout) mView.findViewById(R.id.my_wallet);
//意见反馈条目
LinearLayout mMineService = (LinearLayout) mView.findViewById(R.id.mine_service);
//小能客服条目
LinearLayout mMineXN = (LinearLayout) mView.findViewById(R.id.mine_xiaoneng);
//关于条目
LinearLayout mMineAbout = (LinearLayout) mView.findViewById(R.id.mine_about);
//如果是调试 则显示小能客服条目
if(isDebug){
mMineXN.setVisibility(View.VISIBLE);
}else{
mMineXN.setVisibility(View.GONE);
}
mUserProfile.setOnClickListener(this);
mMineSetting.setOnClickListener(this);
mMinWallet.setOnClickListener(this);
mMineService.setOnClickListener(this);
mMineAbout.setOnClickListener(this);
mMineXN.setOnClickListener(this);
}
示例8: FriendSearchItemHolder
import android.view.View; //导入方法依赖的package包/类
public FriendSearchItemHolder(View itemView) {
super(itemView);
avatarImv = (ImageView) itemView.findViewById(R.id.avatarImv);
nickTv = (TextView) itemView.findViewById(R.id.nickTv);
collegeTv = (TextView) itemView.findViewById(R.id.sInfo);
}
示例9: createView
import android.view.View; //导入方法依赖的package包/类
/**
* create a view from resource Xml file, and hold the view that may be used in displaying data.
*
* @param layoutInflater
*/
@Override
public View createView(LayoutInflater layoutInflater) {
View view = layoutInflater.inflate(R.layout.with_long_press_list_view_item, null);
mImageView = (CubeImageView) view.findViewById(R.id.with_long_press_list_image);
return view;
}
示例10: onCreateView
import android.view.View; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Intent intent = getActivity().getIntent();
userClass = (UserClass) intent.getSerializableExtra("Class");
userExam = (Exam) intent.getSerializableExtra("Exam");
students = userClass.getStudents();
View view = inflater.inflate(R.layout.fragment_show_class_components
, container, false); // Inflate the layout for this fragment
if(students != null) {
RecyclerView recyclerView = (RecyclerView) view
.findViewById(R.id.recycler_class_components);
recyclerView.setAdapter(new ShowClassComponentsFragment
.ShowClassComponentAdapter(students, getActivity()
.getApplicationContext(), recyclerView));
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
}
return view;
}
示例11: onCreateView
import android.view.View; //导入方法依赖的package包/类
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View rootView = inflater.inflate(R.layout.fragment_all_posts, container, false);
// [START create_database_reference]
mDatabase = FirebaseDatabase.getInstance().getReference();
// [END create_database_reference]
mRecycler = (RecyclerView) rootView.findViewById(R.id.messages_list);
mRecycler.setHasFixedSize(true);
return rootView;
}
示例12: NumberViewHolder
import android.view.View; //导入方法依赖的package包/类
/**
* Constructor for our ViewHolder. Within this constructor, we get a reference to our
* TextViews and set an onClickListener to listen for clicks. Those will be handled in the
* onClick method below.
* @param itemView The View that you inflated in
* {@link GreenAdapter#onCreateViewHolder(ViewGroup, int)}
*/
public NumberViewHolder(View itemView) {
super(itemView);
listItemNumberView = (TextView) itemView.findViewById(R.id.tv_item_number);
// TODO (11) Use itemView.findViewById to get a reference to tv_view_holder_instance
viewHolderIndex = (TextView) itemView.findViewById(R.id.tv_view_holder_instance);
}
示例13: get
import android.view.View; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends View> T get(View view, int id) {
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
if (viewHolder == null) {
viewHolder = new SparseArray<View>();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null) {
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
}
示例14: onCreateView
import android.view.View; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fr_simple_card, null);
TextView card_title_tv = (TextView) v.findViewById(R.id.card_title_tv);
card_title_tv.setText(mTitle);
return v;
}
示例15: MyHolder
import android.view.View; //导入方法依赖的package包/类
public MyHolder(View v)
{
super(v);
button = (Button) v.findViewById(R.id.button);
button.setOnLongClickListener(this);
}