Android
记录并分享学习android编程进行开发AndroidAPP的过程和遇到的问题
xxm0720
这个作者很懒,什么都没留下…
展开
-
android的基础
一个控件绑定多个点击或者长按事件,想让执行一次,就return true,return false表示执行这个事件还没有结束还要执行另外一个事件原创 2020-08-11 22:30:57 · 118 阅读 · 0 评论 -
android的基础 ImageView
ImageView的基本属性 android:scaleType有一些值代表图片的渲染方式 fitXY 代表X,和Y轴都充满整个view fitCenter 保持宽高比 知道能够完全显示 centerCrop 保持宽高比 知道完全覆盖控件 裁剪显示 要想加载一张网络图片先在网上找一个控件比如 glide 先在gradle中引用在初始化,再在 AndroidManifest.xml中声明 <uses-permission android:name="android原创 2020-08-10 22:33:26 · 201 阅读 · 0 评论 -
android的基础CheckBox
CheckBox 左侧的选择框的样式也是用drawable,(android:button="@...."),距离用paddingLeft //这是多选 监听其中一个 check1= this.<CheckBox>findViewById(R.id.check1); check1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override原创 2020-08-06 22:02:47 · 99 阅读 · 0 评论 -
android的基础 RadioButton
首先 button的点击事件创建函数 private void setListeners (){ Onclick onClick=new Onclick(); mBtnText.setOnClickListener(onClick); btn1.setOnClickListener(onClick); btn2.setOnClickListener(onClick); radioBtn.setOnClickListener.原创 2020-08-04 22:52:16 · 557 阅读 · 0 评论 -
android基础EditText
EditText android:inputType 是决定弹出什么键盘的! android:hint 输入框输入前的提示语 android:maxLines 最大行数 android:drawableLeft 输入框的左边的图标 android:drawablePadding 图标距离文字的距离 //EditText 监听输入内容的变化 edit_1.addTextChangedListener(new TextWatcher() { @O...原创 2020-08-03 22:23:24 · 115 阅读 · 0 评论 -
android 点击事件的写法
//第一种是在JAVA代码里写 private Button btn3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_button); btn3= this.<Button>findViewById(.原创 2020-08-02 22:45:56 · 202 阅读 · 0 评论 -
android的基础 button 按钮
Button自定义背景颜色的形状 1,先在res中的drawable新建的 Drawable Resource File 新建 Root Element 的shape文件 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid ..原创 2020-08-02 22:42:32 · 206 阅读 · 0 评论 -
android的基础 4
TextView android:maxLines="1" //最多一行 android:maxLines="1" android:ellipsize="end" //一行超出出现省略号 //一行跑马灯 android:layout_width="300dp" android:layout_height="wrap_content" android:text="红尘紫红尘紫红尘红尘紫红尘紫红尘尘红尘红尘紫红尘紫红尘尘红尘尘红尘" android:textColor="#000" and.原创 2020-07-30 23:06:10 · 311 阅读 · 0 评论 -
android的基础3
相对布局:(RelativeLayout) layout_alignParentBottom //父元素的下面,横向位置不变 值为true layout_alignParentRight //父元素的右面,竖向位置不变 值为true layout_toRightOf //值为id,为这个元素的右边 layout_below //值为id,为这个元素的下边 等等! ...原创 2020-07-29 23:26:52 · 102 阅读 · 0 评论 -
android的基础2
注意:对大小写有区别! 常用的属性: android:id android:layout_margin android:layout_width android:layout_padding android:layout_height android:background android:orientation //线性布局的方向,横向或者竖向 match_parent //上一级元素的尺寸 wrap_content //内容的尺..原创 2020-07-28 22:18:04 · 85 阅读 · 0 评论 -
android的基础(1)
androidx.constraintlayout.widget.ConstraintLayout:约束布局, LinearLayout:线性布局 1,约束布局 是Google推出的新的布局组件,它出现的目的一是为了减少布局中ViewGroup的层级嵌套,二是为了适应更灵活的布局需求,它有点类似于RelativeLayout但是又比RelativeLayout强大很多,比如RelativeLayout中你可以让一个TextView在中横向居中,但是你很难让它处于横向30%的位置。如果在RelativeL.原创 2020-07-27 21:53:15 · 160 阅读 · 0 评论