gpt4 book ai didi

android - 不可分配给 android.app.activity

转载 作者:太空宇宙 更新时间:2023-11-03 10:18:01 29 4
gpt4 key购买 nike

我的项目显示红色突出显示的文本我需要修复我的项目我不确定是什么导致了这种情况发生任何建议。

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="scrape2.myapplication" >

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="scrape2.myapplication.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity2Activity"
android:label="@string/title_activity_main_activity2" >
</activity>
</application>

</manifest>



<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="match_parent"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/parse_html"
android:id="@+id/html_content"
android:textSize="16sp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="119dp" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:text="html"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_x="186dp"
android:layout_y="1dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/parse_html"
android:id="@+id/textView1"
android:textSize="16sp"
android:singleLine="false"
android:layout_marginTop="107dp"
android:layout_below="@+id/html_content" />

<ListView
android:id="@+id/listView2"
android:layout_width="355dp"
android:layout_height="421dp"
android:layout_x="20dp"
android:layout_y="118dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/button"
android:layout_toStartOf="@+id/button"
android:layout_x="264dp"
android:layout_y="-1dp" />

</RelativeLayout>

我不确定为什么会这样,请分享一些提示,谢谢。

我尝试清理项目,也点击了重建仍然没有成功

Activity 课

package scrape2.myapplication;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import static scrape2.myapplication.Constants.FIFTH_COLUMN;
import static scrape2.myapplication.Constants.FIRST_COLUMN;
import static scrape2.myapplication.Constants.FOURTH_COLUMN;
import static scrape2.myapplication.Constants.SECOND_COLUMN;
import static scrape2.myapplication.Constants.THIRD_COLUMN;



public class MainActivity extends ActionBarActivity {
private ArrayList<HashMap<String, String>> list;
public int count = 0;
public String temp;
private Document htmlDocument;
private String htmlPageUrl = "http://en.masjidway.com/masjid/2804/prayer";
private TextView parsedHtmlNode;
private TextView textViewwww;
private String htmlContentInStringFormat;
private String dayys;
private String amarrdatta;
private String duhr_val1;
private String asr_val1;
private String maghreb_val1;
private String isha_val1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

parsedHtmlNode = (TextView)findViewById(R.id.html_content);
textViewwww = (TextView)findViewById(R.id.textView1);
Button button2 = (Button)findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(MainActivity.this, MainActivity2Activity.class);
MainActivity.this.startActivity(myIntent);
}
});
Button htmlTitleButton = (Button)findViewById(R.id.button);
htmlTitleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
JsoupAsyncTask jsoupAsyncTask = new JsoupAsyncTask();
jsoupAsyncTask.execute();


}
});
w(ListView)findViewById(R.id.listView2);
String zuhrr =duhr_val1;//2
w

最佳答案

您的 RelativeLayout 不属于 AndroidManifest.xml。您应该为每个布局创建一个新的 xml 文件。

关于android - 不可分配给 android.app.activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32031638/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com