社区
Android
帖子详情
android:id="@+id/my_button"和android:id="@android:id/empty"问题
hnyz2000
2010-03-28 06:38:49
各位大侠,
小弟很菜,一直没看明白自定义的id和调用系统的id到底具体有什么区别?按照文档上面说id是为了给控件一个名称方便程序调用,但是若是直接用系统的(如empty)那是什么含义了?若是程序中调用难道就是R.id.empty?应该不会是这样吧?
可能是小弟英文不好没有特别看明白那段话,哪位大哥能给点启发?最好是能给个例子,非常感谢
...全文
6957
34
打赏
收藏
android:id="@+id/my_button"和android:id="@android:id/empty"问题
各位大侠, 小弟很菜,一直没看明白自定义的id和调用系统的id到底具体有什么区别?按照文档上面说id是为了给控件一个名称方便程序调用,但是若是直接用系统的(如empty)那是什么含义了?若是程序中调用难道就是R.id.empty?应该不会是这样吧? 可能是小弟英文不好没有特别看明白那段话,哪位大哥能给点启发?最好是能给个例子,非常感谢
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
34 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
DyEnigma
2012-08-23
打赏
举报
回复
[Quote=引用 31 楼 的回复:]
对,我也不了解这个
引用 30 楼 的回复:
引用 6 楼 的回复:
引用 3 楼 chenzhp 的回复:
@+id 新增一个资源id
@id和android:id,引用现有的资源id
恩 讲的很清楚了
请问,@id和@android:id有什么区别吗?
[/Quote]
@id引用你自己定义的资源id,@adnroid:id引用系统资源id,具体有哪些系统资源id,请查询:
http://developer.android.com/reference/android/R.id.html
楼主所问的那个android:id="@android:id/empty"就属于系统资源id,可以在上面的连接显示页面中找到
经常在黑云中出没
2012-05-15
打赏
举报
回复
@+id 新增一个资源id
Android10086
2012-05-13
打赏
举报
回复
对,我也不了解这个
[Quote=引用 30 楼 的回复:]
引用 6 楼 的回复:
引用 3 楼 chenzhp 的回复:
@+id 新增一个资源id
@id和android:id,引用现有的资源id
恩 讲的很清楚了
请问,@id和@android:id有什么区别吗?
[/Quote]
dahutiger
2012-04-18
打赏
举报
回复
[Quote=引用 6 楼 的回复:]
引用 3 楼 chenzhp 的回复:
@+id 新增一个资源id
@id和android:id,引用现有的资源id
恩 讲的很清楚了
[/Quote]
请问,@id和@android:id有什么区别吗?
追风筝的孩子
2012-02-09
打赏
举报
回复
继承ListActivity的时候需要用到
宋工
2011-10-15
打赏
举报
回复
"@id/android:empty";表示若LIstView没有内容则显示的提示.
你可以这样测试.你的list里面不要add任何数据.那这个list就是空的.
那么他就会按照"@id/android:empty"所定义的textView样式显示了
不用了的号
2011-07-12
打赏
举报
回复
coolgo
2011-07-08
打赏
举报
回复
很好,帮顶了
b87936260
2011-06-24
打赏
举报
回复
对头,前些天正好用过listView
ryfsoft
2011-06-23
打赏
举报
回复
对,正好碰到,我今天开始学android 第三天,先前看到xml 里面 控件 id写法都是 比如:android:id="@+id/listLayout" 这样的写法,可学到 ListView 控件的时候id 写法是
android:id="@id/android:list"
liurihei
2011-06-23
打赏
举报
回复
[Quote=引用 3 楼 chenzhp 的回复:]
@+id 新增一个资源id
@id和android:id,引用现有的资源id
[/Quote]
解答
jeky_zhang2013
2011-06-22
打赏
举报
回复
简洁明了~哈哈
「已注销」
2011-06-22
打赏
举报
回复
恩,学习学习~
w7244958
2011-04-18
打赏
举报
回复
跟着学习。android:id=@+id/android:empty -- 在listview没有数据的时候用。
yongyuandeni
2011-04-12
打赏
举报
回复
[Quote=引用 3 楼 chenzhp 的回复:]
@+id 新增一个资源id
@id和android:id,引用现有的资源id
[/Quote]
就是这个
皓月明
2010-10-17
打赏
举报
回复
在listview没有数据的时候用这个
L____
2010-09-09
打赏
举报
回复
android:id=@+id/android:empty
这是什么意思 一直没搞明白, 好像是当什么空白时候显示这个....
Temofil
2010-06-22
打赏
举报
回复
学习学习 这样的帖子很不错 帮顶
shankaipingo
2010-04-13
打赏
举报
回复
是直接用系统的(如empty)那是什么含义了?
这个好像楼上几位没有回答
smacexu
2010-04-12
打赏
举报
回复
纯支持一下
加载更多回复(8)
安卓播放SD卡上的视频功能
安卓开发中,开发播放SD卡上的视频的功能,在一个主活动中通过按钮控制视频播放开始和暂停,适合初学者。
LCRap
id
Develop-master
# Rap
id
Develop-
Andro
id
快速开发框架 - 框架持续更新中 - 这个框架是从平时项目里用的比较多的框架里整合而来 - 对本项目感兴趣的可以一起研究喜欢的朋友欢迎star - 同时也欢迎大家的宝贵意见issues - 如果大家对MVP模式的开发 网络爬虫以及缓存策略感兴趣的话可以看看我最新写的[Freebook](https://github.com/80945540/FreeBook) - 邮箱:mychinalance@gmail.com - [API地址](http://mylance.top/index.html) - [下载APK](http://fir.im/LCRap
id
Develop) ###[English](README_EN.md) -------- ##功能说明 - 异常崩溃统一管理 - retrofit rxjava okhttp rxcache------------------------------网络请求以及网络缓存 - Demo采用MVP模式开发------------------------------------数据逻辑复用,便于维护升级 - 下拉刷新 上拉加载 及自动加载---------------------------实现监听方便快捷 - RecyclerView设配器------------------------------------------再也不需要写ViewHolder - RecyclerView item加载动画--------------------------------多种动画效果一行代码解决 - 页面状态统一管理 加载中 无数据 无网络-------------所有页面均可添加 - 图片显示与缓存 GIF图片显示 - Tab+Fragment快速实现 - 视频播放(仿QQ空间,秒拍等List播放) -------- ##效果图展示       -------------- ##使用说明 导入 lcrap
id
developlibrary 到项目 在 build.gradle 的 dependencies 添加: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') .... compile project(':lcrap
id
developlibrary') } ##轻松实现异常统一管理 MyApplication里面初始化就可以了 ``` public class MyApplication extends Application { @Overr
id
e public vo
id
onCreate() { super.onCreate(); //初始化异常管理工具 Recovery.getInstance() .debug(true)//关闭后 在错误统一管理页面不显示异常数据 .recoverInBackground(false) .recoverStack(true) .mainPage(WelcomeActivity.class)//恢复页面 .init(this); } } ``` ##轻松实现 状态页面 下拉刷新 自动加载 item动画 首先layout.xml里面的编写啦 列表页面基本都是这个套路 ``` <!--ProgressActivity用于状态页的控制 比如加载中 网络异常 无数据 适合任何页面-->
iddeveloplibrary.viewtype.ProgressActivity xmlns:progressActivity="http://schemas.
andro
id
.com/apk/res-auto"
andro
id
:
id
="@+
id
/progress"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent">
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent"
andro
id
:orientation="vertical" > <!--SpringView下拉刷新-->
iddeveloplibrary.w
id
get.SpringView
andro
id
:
id
="@+
id
/springview"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent"
andro
id
:background="#FFFFFF" > <
andro
id
.support.v7.w
id
get.RecyclerView
andro
id
:
id
="@+
id
/rv_list"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent"
andro
id
:background="#eeeeee"/>
iddeveloplibrary.w
id
get.SpringView>
iddeveloplibrary.viewtype.ProgressActivity> ``` 然后就是Activity里面的编写了 这个例子里使用MVP模式编写感兴趣的看我最新写的[Freebook](https://github.com/80945540/FreeBook) ``` public class ListvViewActivity extends AppCompatActivity implements BaseQuickAdapter.RequestLoadMoreListener,SpringView.OnFreshListener,SchoolListView { RecyclerView mRecyclerView; ProgressActivity progress; private Toolbar toolbar; private BaseQuickAdapter mQuickAdapter; private int PageIndex=1; private SpringView springView; private SchoolListPresent present; @Overr
id
e protected vo
id
onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_listv_view); initView(); } private vo
id
initView() { present = new SchoolListPresent(this); mRecyclerView = (RecyclerView) findViewBy
Id
(R.
id
.rv_list); springView = (SpringView) findViewBy
Id
(R.
id
.springview); //设置下拉刷新监听 springView.setListener(this); //设置下拉刷新样式 springView.setHeader(new RotationHeader(this)); //springView.setFooter(new RotationFooter(this));mRecyclerView内部集成的自动加载 上啦加载用不上 在其他View使用 progress = (ProgressActivity) findViewBy
Id
(R.
id
.progress); //设置RecyclerView的显示模式 当前List模式 mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); //如果Item高度固定 增加该属性能够提高效率 mRecyclerView.setHasFixedSize(true); //设置页面为加载中.. progress.showLoading(); //设置适配器 mQuickAdapter = new ListViewAdapter(R.layout.list_view_item_layout,null); //设置加载动画 mQuickAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); //设置是否自动加载以及加载个数 mQuickAdapter.openLoadMore(6,true); //将适配器添加到RecyclerView mRecyclerView.setAdapter(mQuickAdapter); //设置自动加载监听 mQuickAdapter.setOnLoadMoreListener(this); //请求网络数据 present.LoadData(PageIndex,12,false); } //自动加载 @Overr
id
e public vo
id
onLoadMoreRequested() { PageIndex++; present.LoadData(PageIndex,12,true); } //下拉刷新 @Overr
id
e public vo
id
onRefresh() { PageIndex=1; present.LoadData(PageIndex,12,false); } /* * MVP模式的相关状态 * * */ @Overr
id
e public vo
id
showProgress() { progress.showLoading(); } @Overr
id
e public vo
id
h
id
eProgress() { progress.showContent(); } @Overr
id
e public vo
id
newDatas(List
newsList) { //进入显示的初始数据或者下拉刷新显示的数据 mQuickAdapter.setNewData(newsList);//新增数据 mQuickAdapter.openLoadMore(10,true);//设置是否可以下拉加载 以及加载条数 springView.onFinishFreshAndLoad();//刷新完成 } @Overr
id
e public vo
id
addDatas(List
addList) { //新增自动加载的的数据 mQuickAdapter.notifyDataChangedAfterLoadMore(addList, true); } @Overr
id
e public vo
id
showLoadFailMsg() { //设置加载错误页显示 progress.showError(getResources().getDrawable(R.mipmap.monkey_cry), Constant.ERROR_TITLE, Constant.ERROR_CONTEXT, Constant.ERROR_
BUTTON
, new View.OnClickListener() { @Overr
id
e public vo
id
onClick(View v) { PageIndex=1; present.LoadData(PageIndex,12,false); } }); } @Overr
id
e public vo
id
showLoadCompleteAllData() { //所有数据加载完成后显示 mQuickAdapter.notifyDataChangedAfterLoadMore(false); View view = getLayoutInflater().inflate(R.layout.not_loading, (ViewGroup) mRecyclerView.getParent(), false); mQuickAdapter.addFooterView(view); } @Overr
id
e public vo
id
showNoData() { //设置无数据显示页面 progress.showEmpty(getResources().getDrawable(R.mipmap.monkey_cry),Constant.EMPTY_TITLE,Constant.EMPTY_CONTEXT); } } ``` ##轻松实现视频列表播放 列表部分和上面的一样就不说了,我这边主要描叙视频播放的部分 是在不懂得可以clone到本地仓库跑一边 item_layout.xml ```
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="wrap_content"
andro
id
:padding="5dp"
andro
id
:orientation="vertical">
iddeveloplibrary.V
id
eo.JCV
id
eoPlayerStandard
andro
id
:
id
="@+
id
/v
id
eo_list_item_playr"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="wrap_content"/>
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent"
andro
id
:orientation="horizontal"
andro
id
:padding="5dp"
andro
id
:gravity="center_vertical">
andro
id
:
id
="@+
id
/v
id
eo_list_item_image"
andro
id
:layout_w
id
th="100dp"
andro
id
:layout_height="70dp"
andro
id
:src="@mipmap/def_head"/>
andro
id
:layout_w
id
th="0dp"
andro
id
:layout_weight="1"
andro
id
:layout_height="wrap_content"
andro
id
:layout_marginLeft="15dp"
andro
id
:layout_marginTop="5dp"
andro
id
:layout_marginBottom="5dp"
andro
id
:layout_marginRight="10dp"
andro
id
:orientation="vertical">
andro
id
:
id
="@+
id
/v
id
eo_list_item_text_title"
andro
id
:layout_w
id
th="wrap_content"
andro
id
:layout_height="wrap_content"
andro
id
:textColor="#666666"
andro
id
:text="标题"
andro
id
:textSize="15dp"/>
andro
id
:
id
="@+
id
/v
id
eo_list_item_text_context"
andro
id
:layout_w
id
th="wrap_content"
andro
id
:layout_marginTop="5dp"
andro
id
:textColor="#999999"
andro
id
:textSize="13dp"
andro
id
:text="内容"
andro
id
:lines="3"
andro
id
:ellipsize="end"
andro
id
:layout_height="wrap_content"/>
``` 然后就是adapter里面对视频控件的赋值处理 ``` public class V
id
eoLisViewAdapter extends BaseQuickAdapter<V
id
eoListDto> { public V
id
eoLisViewAdapter(int layoutRes
Id
, List<V
id
eoListDto> data) { super(layoutRes
Id
, data); } public V
id
eoLisViewAdapter(List<V
id
eoListDto> data) { super(data); } public V
id
eoLisViewAdapter(View contentView, List<V
id
eoListDto> data) { super(contentView, data); } @Overr
id
e protected vo
id
convert(BaseViewHolder helper, V
id
eoListDto item) { helper.setText(R.
id
.v
id
eo_list_item_text_title,item.getTitle()).setText(R.
id
.v
id
eo_list_item_text_context,item.getIntroduction()); //Gl
id
e加载图片 并且支持gif动图 Gl
id
e.with(mContext) .load(item.getPictureUrl()) .crossFade() .placeholder(R.mipmap.def_head) .into((ImageView) helper.getView(R.
id
.v
id
eo_list_item_image)); //对视频的赋值 添加视频播放地址(使用原地址 .mp4之类的 这个要注意)和标题 ((JCV
id
eoPlayerStandard)helper.getView(R.
id
.v
id
eo_list_item_playr)).setUp(item.getAppV
id
eoUrl(),item.getTitle()); Gl
id
e.with(mContext) .load(item.getPictureUrl()) .crossFade() .placeholder(R.mipmap.main_mini_m) .into((((JCV
id
eoPlayerStandard) helper.getView(R.
id
.v
id
eo_list_item_playr)).thumbImageView)); } } ``` ###Tab+Fragment快速实现 还是原来的配方 layout.xml ``` <?xml version="1.0" encoding="utf-8"?>
andro
id
="http://schemas.
andro
id
.com/apk/res/
andro
id
" xmlns:tools="http://schemas.
andro
id
.com/tools"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent" xmlns:app="http://schemas.
andro
id
.com/apk/res-auto"
andro
id
:orientation="vertical" tools:context="com.xiaochao.lcrap
id
develop.UI.Tab.TabActivity"> <
andro
id
.support.v7.w
id
get.Toolbar
andro
id
:
id
="@+
id
/toolbar"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="?attr/actionBarSize"
andro
id
:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> <!--显示头部滑块--> <FrameLayout
andro
id
:
id
="@+
id
/tab"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="wrap_content"
andro
id
:background="#fff" /> <
andro
id
.support.v4.view.ViewPager
andro
id
:
id
="@+
id
/viewpager"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="match_parent" />
``` 然后就是头部的xml编写了 ```
iddeveloplibrary.SmartTab.SmartTabLayout xmlns:
andro
id
="http://schemas.
andro
id
.com/apk/res/
andro
id
" xmlns:app="http://schemas.
andro
id
.com/apk/res-auto"
andro
id
:
id
="@+
id
/viewpagertab"
andro
id
:layout_w
id
th="match_parent"
andro
id
:layout_height="40dp"
andro
id
:background="#FFFFFF" app:stl_defaultTabTextColor="@color/custom_tab" app:stl_distributeEvenly="true" app:stl_defaultTabTextHorizontalPadding="5dp" app:stl_indicatorColor="@color/title_bag" app:stl_indicatorCornerRadius="0dp" app:stl_indicatorInterpolation="smart" app:stl_indicatorThickness="3dp" app:stl_defaultTabTextSize="13dp" app:stl_div
id
erColor="@color/bag_gray" app:stl_div
id
erThickness="1dp" app:stl_overlineColor="@color/bag_gray" app:stl_underlineColor="#00000000" app:stl_defaultTabBackground="@color/bag_gray_transparent" /> ``` 完全可以按照自己想要的风格玩 下面表格为 可设置的属性 --------- |attr|描述| |:--|:-------| | stl_indicatorAlwaysInCenter | 如果设置为真,有源标签总是显示在中心(如报摊google app),默认的错误| | stl_indicatorWithoutPadding | 如果设置为true,画的指标没有填充选项卡中,默认的错误| | stl_indicatorInFront | 画前的指示器下划线,默认的错误| | stl_indicatorInterpolation | 行为的指标:“线性”或“智能”| | stl_indicatorGravity | 图的位置指示器:“底”或“前”或“中心”,默认“底”| | stl_indicatorColor | 标志的颜色| | stl_indicatorColors | 多种颜色的指标,可以设置每个选项卡的颜色| | stl_indicatorThickness | 厚度指标| | stl_indicatorW
id
th | 的宽度指标,默认“汽车”| | stl_indicatorCornerRadius | 圆角半径的指标| | stl_overlineColor | 顶线的颜色| | stl_overlineThickness | 顶线的厚度| | stl_underlineColor | 颜色的底线| | stl_underlineThickness | 厚度的底线| | stl_div
id
erColor| 颜色之间的分隔器选项卡| | stl_div
id
erColors| 多种颜色的选项卡之间的分隔器,可以设置每个选项卡的颜色| | stl_div
id
erThickness | 分频器的厚度| | stl_defaultTabBackground | 背景可拉的每个选项卡。 一般设置StateListDrawable| | stl_defaultTabTextAllCaps | 如果设置为真,所有选项卡标题大写,违约事实| | stl_defaultTabTextColor | 文本的颜色包括默认的选项卡| | stl_defaultTabTextSize | 文本包括默认的选项卡的大小| | stl_defaultTabTextHorizontalPadding| 文本布局填充默认的选项卡包括| | stl_defaultTabTextMinW
id
th| 最小宽度的标签| | stl_customTabTextLayout
Id
| 布局
ID
定义自定义选项卡。 如果你不指定一个布局,使用默认选项卡| | stl_customTabTextView
Id
| 文本视图
ID
在一个自定义选项卡布局。 如果你不与customTabTextLayout
Id
定义,不工作| | stl_distributeEvenly | 如果设置为真,每个选项卡都给出同样的重量,默认的错误| | stl_clickable | 如果设置为false,禁用选择选项卡单击,违约事实| | stl_titleOffset | 如果设置为“auto_center”,中间的幻灯片的位置选项卡中心将继续。 如果指定一个维度将抵消从左边缘,默认24 dp| | stl_drawDecorationAfterTab | 画装饰(指示器和线)绘图选项卡后,默认的错误| -------- 好了接下来就TabActivity ``` public class TabActivity extends AppCompatActivity { ViewGroup tab; ViewPager viewpager; @Overr
id
e protected vo
id
onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab); initView(); } private vo
id
initView() { tab = (ViewGroup) findViewBy
Id
(R.
id
.tab); viewpager = (ViewPager) findViewBy
Id
(R.
id
.viewpager); //使用方才定义头部 tab.addView(LayoutInflater.from(this).inflate(R.layout.tab_top_layout, tab, false)); SmartTabLayout viewPagerTab = (SmartTabLayout) findViewBy
Id
(R.
id
.viewpagertab); FragmentPagerItems pages = new FragmentPagerItems(this); //添加Fragment FragmentPagerItem.of("头部显示标题", "建立的fragment","需要传值的可以传Bundle") for (int i=0;i<4;i++) { pages.add(FragmentPagerItem.of("Tab"+i, TabFragment.class)); } FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( getSupportFragmentManager(), pages); viewpager.setAdapter(adapter); viewPagerTab.setViewPager(viewpager); } } ``` -------- ##特别感谢 - [JieCaoV
id
eoPlayer](https://github.com/lipangit/JieCaoV
id
eoPlayer) - [SpringView](https://github.com/liaoinstan/SpringView) - [SmartTabLayout](https://github.com/ogaclejapan/SmartTabLayout) - [BaseRecyclerViewAdapterHelper](https://github.com/CymChad/BaseRecyclerViewAdapterHelper) - [Recovery](https://github.com/80945540/Recovery)
安卓实验广播机制的实现
andro
id
studio广播实验
Andro
id
_listView学习的
问题
(2021年4月14日205555).docx
Andro
id
使用按钮时,按钮文字默认是全部大写,可以通过textAllCaps设置为允许小写
State List Drawable状态列表绘制
Andro
id
摘要:Java源码,
Andro
id
,状态列表 State List Drawable状态列表绘制
Andro
id
源码下载,是一个挺小的
Andro
id
编程小例子,希望大家喜欢哦。
Android
80,472
社区成员
91,383
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章