我自定义了一个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后面得不到我自己定义的索引,怎么办?
解决方案 »
- Android 锁屏界面怎么增加快捷按钮
- Android MediaRecorder 录音setAudioSource failed
- 为什么android edittext只有一条蓝线啊,怎么解决?
- 图标设计工具 背景如何设置透明 Launcher Icon Generator
- 怎样截获其他程序的触摸事件,或模拟轨迹球
- 毕设要做一个电子书软件
- 请教:android ndk编程
- 如网页中的效果,我想在android上实现,求高手给思路
- Android 的Wi-Fi问题,急!!!
- Android云化好友名单
- 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