有一個listView
和imageView
,text
和button
在活動A。如果listView.size等於0,則會顯示image
,text
和button
,如果不等於0,則會顯示listView
。使用真實設備時的佈局運行
我需要爲此有一個單獨的佈局嗎?一個用於imageView
,text
和button
,另一個用於listView
?
目前我使用相同的佈局,但是當我使用我的真實設備運行時,image
,text
和button
的設計稍微運行。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ImageView
android:src="@mipmap/data"
android:paddingTop="30dp"
android:layout_gravity="center"
android:layout_width="330dp"
android:layout_height="300dp"
android:id="@+id/imageView"
android:paddingLeft="20dp"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No Data"
android:textSize="15dp"
android:layout_marginLeft="140dp"
android:paddingTop="160dp"
android:textColor="@color/honey_dew2"
android:layout_gravity="center"
android:id="@+id/NoData"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Data"
android:paddingTop="20dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="130dp"
android:id="@+id/button2"
android:layout_centerVertical="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView2"
android:layout_weight="1"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>
</RelativeLayout>
Android Studio中
真實設備(顯示圖像,文本和按鈕僅因爲listView.size等於0)
'java.lang.IllegalStateException:在RelativeLayout中不存在循環依賴關係' – Tony
SIR CAN YOU PLEASE HELP http:// stackoverflow。com/users/2987882/ai – Tony
@Tony這是什麼鏈接,問題在哪裏 – meda