我自定义了一个MyRadioButton继承自android.widget.RadioButton,然后在loyout文件中注册如下
<com.selfDefinedThings.MyRadioButton
android:id="@+id/selfid"
zlt:fff="初始值"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sfeee"
></com.selfDefinedThings.MyRadioButton>
我在Activity中用findViewById方法中用R.id后面得不到我自己定义的索引,怎么办?
<com.selfDefinedThings.MyRadioButton
android:id="@+id/selfid"
zlt:fff="初始值"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sfeee"
></com.selfDefinedThings.MyRadioButton>
我在Activity中用findViewById方法中用R.id后面得不到我自己定义的索引,怎么办?
解决方案 »
- FileObserver可以监视文件操作,但是如何获得操作者的信息?
- 如何学习android文件系统
- 腾讯微博java(android) api 包含95%接口,使用简单
- 关于android自动适应机型分辨率的问题
- 在手机存储上创建文件问题(不是在sdcard的)
- 用Android sdk 中的模拟器,为什么我改了内存还是不变?
- 求救,eclipse创建不了android project
- 一键刷机的原理
- 向大神求助。。Android程序异常
- android socket通信,,手机在3g网下与pc通信,手机与手机之间通过socket通信
- NDK例子的中,C文件找不到头文件,应该如何设置包含
- 我有一个类继承了ViewGroup(ViewGroup继承View),我如何获取getWindow呢
<resources> <declare-styleable name="MyRadioButton">
<attr name="fff" format="string"/>
</declare-styleable>
</resources>
不知道zlt命名空间要改成什么,不是随便定义的吗?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:zlt="http://schemas.android.com/apk/res/com.fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <com.selfDefinedThings.MyRadioButton
android:id="@+id/selfid"
zlt:fff="初始值"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sfeee"
></com.selfDefinedThings.MyRadioButton></LinearLayout>
是,我的packagename 是在这个下 com.fragment