我只是啓動一個小部件,它的xml在AS上的模擬器中顯示imageview,但無論我將imageview放在圖像不顯示的位置。這裏是小部件的我的XML佈局Android Widget ImageView不顯示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333"
android:padding="@dimen/widget_margin">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@android:drawable/ic_popup_sync"
android:id="@+id/imageView"
android:layout_alignParentLeft="true"/>
<LinearLayout
android:orientation="horizontal"
android:layout_alignLeft="@+id/imageView"
android:layout_alignRight="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10">
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4">
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView2" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView3" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView4" />
</LinearLayout>
<TextView
android:text="16:00"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/textView5"
android:textSize="20sp"
android:layout_weight="3" />
<TextView
android:text="14:00"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="@+id/textView6"
android:layout_weight="1" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:srcCompat="@android:drawable/ic_media_next"
android:id="@+id/imageView2" />
</RelativeLayout>
即使我把的LinearLayout或RelativeLayout的硬編碼DP或其他選項裏,甚至與其他項目的圖片這是確定內部改變應用程序,沒有顯示。我只是想知道它沒有顯示的原因是什麼。
對於遲到的回覆感到抱歉,我試過這種方式,它仍然沒有渲染任何東西。 – CbL