Android include 标签注意点
来源:互联网 发布:zeppelin软件下载 编辑:程序博客网 时间:2024/04/29 00:51
1,listview加载底边栏.
2.底边栏布局如下:
<?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" android:orientation="vertical" > <FrameLayout android:id="@+id/main_content" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /> <RadioGroup android:id="@+id/tab_menu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/mmfooter_bg" android:orientation="horizontal" > <RadioButton android:id="@+id/rb_recommand" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="1" android:button="@null" android:checked="true" android:drawableTop="@drawable/recommand" android:gravity="center_horizontal|bottom" android:paddingTop="2dp" android:text="推荐" android:textColor="@color/tab_selector_tv_bottom" /> <RadioButton android:id="@+id/rb_order" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/order" android:gravity="center_horizontal|bottom" android:paddingTop="2dp" android:text="预约" android:textColor="@color/tab_selector_tv_bottom" /> <RadioButton android:id="@+id/rb_message" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/message" android:gravity="center_horizontal|bottom" android:paddingTop="2dp" android:text="消息" android:textColor="@color/tab_selector_tv_bottom" /> <RadioButton android:id="@+id/rb_mine" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/mine" android:gravity="center_horizontal|bottom" android:paddingTop="2dp" android:text="我的" android:textColor="@color/tab_selector_tv_bottom" /> </RadioGroup></LinearLayout>3.主xml布局如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/lv_mylv" android:layout_width="match_parent" android:layout_height="match_parent" /> <include layout="@layout/bottom_item" /></RelativeLayout>4.在java中引用,我的没有在include中引入id属性:
private ListView lv_mylv;private MyAdapter adapter;private RadioButton recommandButton;private RadioButton orderButton;private RadioButton messageButton;private RadioButton mineButton;private Intent intent;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);adapter = new MyAdapter(this);recommandButton = (RadioButton) findViewById(R.id.rb_recommand);orderButton = (RadioButton) findViewById(R.id.rb_order);messageButton = (RadioButton) findViewById(R.id.rb_message);mineButton = (RadioButton) findViewById(R.id.rb_mine);直接找到bottom.item.xml中的radiobutton.
5.如果在include中引用了id,还需要为include指定id属性。
View layout = getLayoutInflater().inflate(R.layout.bottom.item.xml, null);
RelativeLayout head= (RelativeLayout)layout.findViewById(R.id.rb_recommand);
简言之,就是加个id,然后在java中先发现layout也就是布局,然后在发现布局的id就好了.
重要,,,,要要..转载: http://www.cnblogs.com/top5/archive/2012/05/07/2486909.html
1 0
- Android include 标签注意点
- Android include 标签注意点
- Android include 标签注意点
- Android include 标签注意点
- Android include 标签注意点
- Android include标签的注意点
- Android include 标签注意点
- include注意点
- android include标签的使用,在RelativeLayout中使用include标签需注意!!!!!
- android include标签的使用,在RelativeLayout中使用include标签需注意!!!!!
- android include标签的使用,在RelativeLayout中使用include标签需注意!!!!!
- android include标签的使用,在RelativeLayout中使用include标签需注意!!!!!
- android布局中使用include及需注意点
- Struts2标签注意点
- html标签注意点
- android include 标签
- Android include 标签
- Android include 标签
- activiti环境搭建
- ios面试题整合2
- PopupWindow的使用
- Leetcode12. Integer to Roman
- error while loading shared libraries: libmysqlclient_r.so.16: cannot open shared object file: No suc
- Android include 标签注意点
- java读取sql脚本文件并写入数据库
- ThinkPHP导入excel表获取数据
- SQLite在多线程环境下的应用
- iOS开发网络篇—数据缓存
- hdu 4533(树状数组区间更新+单点查询)
- C++ 提取图像ROI保存到Mat
- 深度理解原型链
- 打印documents 本地文件