0

問題にまっすぐ。

//This is my main layout
RemoteViews views = null;
views = new RemoteViews(getPackageName(), R.layout.main); 

//Clear parent view
views.removeAllViews(R.id.llMain);

//This is how we add nested view
RemoteViews childView = new RemoteViews(getPackageName(), R.layout.lay_child);
views.addView(R.id.llMain, childView);

コードは Galaxy Nexus でうまく動作します。ただし、Galaxy Tab や Motorola などの他のデバイスではそうではありません。なにが問題ですか?

「ビューが見つかりませんでした。代わりにエラー ビューを使用しています」のようなエラー メッセージが返されます。エラー view android.widget.RemoteViews$ActionException: can't find view: 0x7f050025 を使用して、updateAppWidget はビューを見つけることができませんでした

//This is the main layout
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#00000000"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/llMain"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"    
        android:orientation="vertical"
        android:layout_gravity="center|left"
        android:layout_marginLeft="@dimen/marginLeft">  

    </LinearLayout>             

</FrameLayout>

そして、これは子ビューです

lay_child.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/llTimezoned"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="visible"
    android:layout_gravity="center">                    
    <ImageView android:id="@+id/ivTimezone"
        android:layout_width="60dp"
        android:layout_height="60dp"
        />     
</LinearLayout>

それともOSのバージョンの関係でしょうか?

4

1 に答える 1