我使用SDK中提供的大图片通知模板(下面的xml)。但在添加此布局后,我无法编译项目。
即使我使用的是架构http://schemas.android.com/apk/prv/res/android
,也应提供layout_minHeight
和layout_maxHeight
。
为什么我有这个问题以及如何解决?
错误:(5)找不到属性的资源标识符 ' layout_minHeight'在包' android'
错误:(5)找不到属性的资源标识符 ' layout_maxHeight'在包' android'
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
internal:layout_minHeight="65dp"
internal:layout_maxHeight="unbounded"
>
<ImageView
android:id="@+id/big_picture"
android:layout_width="match_parent"
android:layout_height="192dp"
android:layout_marginTop="64dp"
android:layout_gravity="bottom"
android:scaleType="centerCrop"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="64dp"
android:scaleType="fitXY"
android:src="@drawable/title_bar_shadow"
/>
<include layout="@layout/notification_template_material_base"
android:layout_width="match_parent"
android:layout_height="64dp"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="208dp"
android:paddingStart="@dimen/notification_large_icon_width"
android:layout_gravity="bottom"
android:background="#CCEEEEEE"
>
<include
layout="@layout/notification_material_action_list"
android:id="@+id/actions"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</FrameLayout>
</FrameLayout>
答案 0 :(得分:0)
将xmlns:internal="http://schemas.android.com/apk/res-auto"
更改为 imageUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Runnable r = new Runnable() {
@Override
public void run() {
final String boundary;
boundary = "===" + System.currentTimeMillis() + "===";
OkHttpClient client = new OkHttpClient();
File file = new File(imageLocation);
String fileName = file.getName();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=" + boundary);
RequestBody body = RequestBody.create(mediaType, boundary + "Content-Disposition: form-data; name=\\\"images\"; filename="+fileName+"\\\"\\r\\nContent-Type: image/jpeg\\\"\\r\\n\\r\\n\\r\\n" + boundary);
Request request = new Request.Builder()
.url("http://localhost:3000/upload")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary="+boundary)
.addHeader("cache-control", "no-cache")
.build();
try {
Response response = client.newCall(request).execute();
}catch (IOException e){
e.printStackTrace();
}
}
};