java.lang.Throwable:addFocusables

时间:2015-06-12 06:56:50

标签: android android-layout

06-12 12:12:55.506: E/ViewGroup(12260): child Null 3, this = android.widget.LinearLayout{41f69a98 V.E..... ......I. 0,0-504,288}
06-12 12:12:55.506: E/ViewGroup(12260): java.lang.Throwable: addFocusables
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3073)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14607)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14607)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14607)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14747)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14612)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14747)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.widget.FrameLayout.draw(FrameLayout.java:534)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14612)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14607)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
06-12 12:12:55.506: E/ViewGroup(12260):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchDraw(PhoneWindow.java:2387)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.View.draw(View.java:14747)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.widget.FrameLayout.draw(FrameLayout.java:534)
06-12 12:12:55.506: E/ViewGroup(12260):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2367)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2841)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl.draw(ViewRootImpl.java:2750)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2587)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2210)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6223)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.Choreographer.doCallbacks(Choreographer.java:591)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.Choreographer.doFrame(Choreographer.java:560)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.os.Handler.handleCallback(Handler.java:808)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.os.Handler.dispatchMessage(Handler.java:103)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.os.Looper.loop(Looper.java:193)
06-12 12:12:55.506: E/ViewGroup(12260):     at android.app.ActivityThread.main(ActivityThread.java:5304)
06-12 12:12:55.506: E/ViewGroup(12260):     at java.lang.reflect.Method.invokeNative(Native Method)
06-12 12:12:55.506: E/ViewGroup(12260):     at java.lang.reflect.Method.invoke(Method.java:515)
06-12 12:12:55.506: E/ViewGroup(12260):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
06-12 12:12:55.506: E/ViewGroup(12260):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
06-12 12:12:55.506: E/ViewGroup(12260):     at dalvik.system.NativeStart.main(Native Method)



its code :-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/bg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:baselineAligned="true"
    android:keepScreenOn="true"
    android:orientation="horizontal" >

    <LinearLayout
        android:id="@+id/LL1"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/LL2"
            android:layout_width="244dp"
            android:layout_height="fill_parent"
            android:layout_weight="0.97"
            android:orientation="vertical"
            android:weightSum="1" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="0.1" >

                <com.androidplot.xy.XYPlot
                    android:id="@+id/Graphs"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    androidPlot.domainLabelWidget.labelPaint.textSize="50dp"
                    androidPlot.graphWidget.backgroundPaint.color=" #000000"
                    androidPlot.graphWidget.gridBackgroundPaint.color="#000000"
                    androidPlot.graphWidget.paddingBottom="50dp"
                    androidPlot.graphWidget.paddingLeft="10dp"
                    androidPlot.graphWidget.paddingRight="20dp"
                    androidPlot.rangeLabelWidget.labelPaint.textSize="40dp"
                    androidPlot.titleWidget.labelPaint.textSize="100dp"
                    androidPlot.titleWidget.rangelabelPaint.textSize="200dp"
                    title="Pulse Scope" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/LL21"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:layout_weight="0.9"
                android:orientation="horizontal"
                android:weightSum="1" 
                android:focusable="true"
                android:background="#738ffe">

                <ImageView
                    android:id="@+id/ivxamp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/xamp" 
                    android:focusable="true"/>

                <TextView
                    android:id="@+id/tvxamp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text=": 0.0" 
                    android:focusable="true"/>

                <ImageView
                    android:id="@+id/ivtime"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/time"
                    android:focusable="true" />

                <TextView
                    android:id="@+id/tvtime"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text=": 0.0" 
                    android:focusable="true"/>

                <ImageView
                    android:id="@+id/ivheartrate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/hr"
                    android:focusable="true" />

                <TextView
                    android:id="@+id/tvheartrate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text=": 0.0" 
                    android:focusable="true"/>

                <ImageView
                    android:id="@+id/ivmeanhr"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/mhr" 
                    android:focusable="true"/>

                <TextView
                    android:id="@+id/tvmeanhr"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text=": 0.0" 
                    android:focusable="true"/>
            </LinearLayout>
        </LinearLayout>

        <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/LL3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tvBluetooth"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Bluetooth"
                    android:textColor="@color/white"
                    android:textSize="14dp" />

                <Button
                    android:id="@+id/bConnect"
                    android:layout_width="50dp"
                    android:layout_height="45dp"
                    android:layout_marginLeft="7dp"
                    android:background="@drawable/bconnect"
                    android:textColor="@color/white"
                    android:textSize="10dp" />

                <Button
                    android:id="@+id/bDisconnect"
                    android:layout_width="50dp"
                    android:layout_height="45dp"
                    android:layout_marginLeft="7dp"
                    android:background="@drawable/bdisconnect"
                    android:textColor="@color/white"
                    android:textSize="10dp" />

                <TextView
                    android:id="@+id/tvControl"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:text="Control"
                    android:textColor="@color/white"
                    android:textSize="15dp" />

                <ToggleButton
                    android:id="@+id/tbStream"
                    android:layout_width="50dp"
                    android:layout_height="45dp"
                    android:layout_alignParentLeft="true"
                    android:layout_marginLeft="7dp"
                    android:background="@drawable/check"
                    android:checked="false"
                    android:textColor="@color/white"
                    android:textOff=""
                    android:textOn="" />

                <ToggleButton
                    android:id="@+id/tbLock"
                    android:layout_width="65dp"
                    android:layout_height="70dp"
                    android:layout_alignParentLeft="true"
                    android:background="@drawable/check_lock"
                    android:checked="true"
                    android:textColor="@color/white"
                    android:textOff=""
                    android:textOn="" />

                <Button
                    android:id="@+id/bInfo"
                    android:layout_width="50dp"
                    android:layout_height="45dp"
                    android:layout_marginLeft="7dp"
                    android:background="@drawable/info"
                    android:textColor="@color/white"
                    android:textSize="10dp" />

                <Button
                    android:id="@+id/folder"
                    android:layout_width="50dp"
                    android:layout_height="45dp"
                    android:layout_marginLeft="7dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/folder" />

                <ProgressBar
                    android:id="@+id/progressBar1"
                    style="?android:attr/progressBarStyleLarge"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_centerHorizontal="true" />
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

</RelativeLayout>

每次嵌套布局更新中最里面的文本视图时,我都会收到此错误。我认为这可能是由于线性布局中的嵌套太多,但我不知道解决它的实际解决方案是什么。我尝试在id = LL21的每个文本视图和线性布局的图像视图中添加setFocusable =“true”。所以,如果有人能帮助我,那就太好了。

0 个答案:

没有答案