0
請幫忙。如果可能的話,我如何將這個代碼從LinearLayout轉換爲相對佈局。或者我能做些什麼來在FAB中使用這個代碼覆蓋?如何將線性佈局轉換爲相對佈局
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:background="@color/white">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<!-- Framelayout to display Fragments -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/emptyScreen">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_empty_list"
android:id="@+id/emptyScreenMsg"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:textColor="@color/gray_text" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/contentScreen" >
<android.support.v4.widget.SwipeRefreshLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/itemsContainer"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@color/white">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:id="@+id/streamListView" />
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="50dp"
android:visibility="gone"
android:background="@color/white"
android:gravity="center"
android:id="@+id/streamAdMobCont">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/loadingScreen"
android:background="@color/white">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/errorScreen"
android:background="@color/white">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error_data_loading"
android:id="@+id/StreamErrorScreenMsg"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity="center"
android:textSize="16dp"
android:textColor="@color/gray_text" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/drawer_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/item_list_row_selector"
android:background="@color/drawer_bg"
android:scrollbars="none"
android:padding="0dp" />
Plaeeaaseeeeeeee幫我pleaseeeeeeeeee ...謝謝的和我的英語不好:)
應用程序崩潰時啓動:( –
發佈崩潰日誌。你改變你的Java代碼嗎?如果您嘗試投下的LinearLayout來的RelativeLayout就會死機。 –
嗨@Sergey,你必須改變你的Java代碼根據Cory Roy – LeoMobDev