我需要这个布局文件的帮助。问题是在Android Studio预览中显示它应该显示,图像底部有一个标题,FAB下的ScrollView中有文本。 我很抱歉这个冗长的xml。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="300dp"
android:id="@+id/detailed_image_view"
android:scaleType="centerCrop"
android:elevation="@dimen/card_height">
</ImageView>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/detailed_title"
android:background="@drawable/white_gradient"
style="@style/large_white_text"
android:layout_alignBottom="@+id/detailed_image_view"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:elevation="10dp"
android:orientation="horizontal"
android:layout_margin="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="@color/accent">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/location_icon"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detailed_location"
style="@style/normal_text"
android:layout_weight="5"
android:layout_marginTop="8dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/time_date_icon"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detailed_date"
style="@style/normal_text"
android:layout_weight="5"
android:layout_marginTop="8dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/price_icon"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detailed_price"
style="@style/normal_text"
android:layout_weight="5"
android:layout_marginTop="8dp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/lorem"
android:id="@+id/detailed_text"
android:elevation="10dp" />
</ScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
app:backgroundTint="@color/accent"
android:src="@drawable/ic_stat_name"
android:layout_margin="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
这是初始化代码
ImageView headerImage = (ImageView) linearLayout.findViewById(R.id.detailed_image_view);
TextView title = (TextView) linearLayout.findViewById(R.id.detailed_title);
TextView date = (TextView) linearLayout.findViewById(R.id.detailed_date);
TextView location = (TextView) linearLayout.findViewById(R.id.detailed_location);
TextView price = (TextView) linearLayout.findViewById(R.id.detailed_price);
TextView text = (TextView) linearLayout.findViewById(R.id.detailed_text);
FloatingActionButton fab = (FloatingActionButton) linearLayout.findViewById(R.id.fab);
EventModel eventModel = bundle.getParcelable("event");
Glide.with(context)
.load(eventModel.getImage())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(headerImage);
title.setText(eventModel.getTitle());
date.setText(eventModel.getDateString());
price.setText("Free");
location.setText(eventModel.getHost());
text.setText(eventModel.getText());
这是它应该看起来的样子,但我在手机上得到的不是&#34; [PLACEHOLDER]&#34;和lorem ipsum文本