首页 > TAG信息列表 > findviewbyid

安卓(Android)期末课程设计

    Android程序设计课程设计单 学号   姓名   性别   指导教师                  项目名称 Android 项目描述 方便查询某地的天气情况,便于外出时提前做好规划。 项目评语       分项成绩 平时成绩 实

进度条学习

activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wra

SurfaceView Attempt to invoke virtual method ‘void com.example.chartactivity.SurfaceViewL.sendData(

使用SurfaceView画图. 一直闪退,一直闪退 软件有时候有不把原因告诉我,然后一直高这个东西搞了很久很久,最后有一次发现他说执行的这个SurfaceViewL是一个null object,然后我去网上找了一下,发现硕士没有找到布局当中的这个控件,但是我明明是由findViewById的呀,等我仔细一看,真

【Android】16,2020-2021蚂蚁金服Android面试真题解析

running = true; new Thread(new Runnable() { @Override public void run() { while (running) { String str = info +"…"; System.out.println(str); try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start(); } @Override

Kotlin控件变量自动映射功能-告别findViewById()方法

只需要在build.gradle(:app)中plugins{...}中添加如下一句即可: id 'kotlin-android-extensions' 我的demo的gradle文件: plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-android-extensions' } 或者使用另一种写法: apply

使提示框居中显示

ToastActivity.java文件: 1 public class ToastActivity extends AppCompatActivity { 2 private Button mbtnToast1,mbtnToast2,mbtnToast3; 3 @Override 4 protected void onCreate(Bundle savedInstanceState) { 5 super.onCreate(savedInstanceSt

单选框弹出提示框

1 private RadioGroup mrg1; 2 @Override 3 protected void onCreate(Bundle savedInstanceState) { 4 super.onCreate(savedInstanceState); 5 setContentView(R.layout.activity_radio_button); 6 mrg1=findViewById(R.id.rg_1); 7

kotlin-android-extension被废弃的原因及viewbinding的优越性

kotlin-android-extensions插件可能算得上是我最喜欢的一个Kotlin在Android上的特性了。 这么说并不夸张,因为以前在使用Java开发Android程序时,我们总是要写一大堆的findViewById,枯燥又没什么意义。 虽然也有一些诸如ButterKnife之类的第三方库,专门用于对findViewById的用法进行

安卓底部导航栏

FrameLayout+碎片实现底部导航 一、效果展示(若觉得画面太大,可单击后观看) 二、底部导航栏布局 1、 新建bottom.xml文件 2、设置布局: 3、代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too

android 单选按钮、复选按钮的使用

一、单选按钮 相互排斥的事件使用该控件,一组相互互斥的事件放到一个组内,及RadioGroup。 <RadioGroup android:id="@+id/radiogroup_text" android:layout_width="match_parent" android:layout_height="wrap_content"> <RadioBut

安卓第10周

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.a

报错:Attempt to invoke virtual method ‘android.view.View android.widget.EditText.findViewById(int)‘

报错:Attempt to invoke virtual method ‘android.view.View android.widget.EditText.findViewById(int)’ 一个非常无语的错: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.widget.EditText.findViewById(in

随笔

界面一:        XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools=&qu

安卓7~8

1.三个界面,界面1点击按钮使用显式意图开启界面2.界面2点击按钮隐式意图开启界面3 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto

基于Android的微信主界面

实现APP门户界面框架设计 门户界面要求:根据课程实操实现APP门户界面框架设计,至少包含4个tab页,能实现tab页之间的点击切换; 主要步骤 一、设计一个自己喜欢的布局 在设计自己最想要的界面布局之前先要考虑好准备使用哪些布局控件,这里我们可以参考微信里面的实际主题布局,我很喜

ASTEST:实现微信界面设计

Android Studio实现类微信界面设计实现步骤: 1.上方栏有标题(居中) 2.中间显示内容,内容随下方栏的选择而切换 3.下方栏分成四个小板块可点击切换 xml文件: top.xml 界面上方栏标题。 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/

第七周作品

1.三个界面,界面1点击按钮使用显式意图开启界面2.界面2点击按钮隐式意图开启界面3 2.在界面1做一个按钮开启浏览器访问百度 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_w

安卓第7周

1. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

安卓第七周

1.三个界面,界面1点击按钮使用显式意图开启界面2.界面2点击按钮隐式意图开启界面3 2.在界面1做一个按钮开启浏览器访问百度 package com.example.app6; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class Activity3 extends Acti

组件

import android.widget.EditText import android.widget.Button //获取组件 var nianji_btn_btn = findViewById<Button>(R.id.nianji_btn); var editText_txt = findViewById<EditText>(R.id.textView2); //按钮点击事件 nianji_btn_btn.setOnClickListener {

Android UI控件详解-EditText(编辑框)

package com.bdqn.edittext; import android.os.Bundle; import android.app.Activity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnKeyListener; import android.widget.EditText; import android.widget.TextView; /** *

Android 文字过多时,可滑动

滚动条 :在Textview里面加一句 :android:scrollbars=“vertical” <TextView android:id="@+id/text" android:text="8号" android:layout_width="200dp" android:layout_height="200dp&

在Fragment中使用findViewById方法

View view = null; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment, null); return view; } //方法1:在 onCraeteView中,将 inflater 填充视图后返回

JAVA日报

从零开始的体温app开发(点击事件) findViewById(R.id.btn).setOnClickListener(this);findViewById(R.id.btn2).setOnClickListener(this);findViewById(R.id.btn3).setOnClickListener(this);findViewById(R.id.btn4).setOnClickListener(this);findViewById(R.id.btn5).setOnClick

butterknife----黄油刀

Butter Knife,专门为Android View设计的绑定注解,专业解决各种findViewById。 简单使用: 添加依赖: Download dependencies { compile 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' } 我们平常写