小编RM3*_*RM3的帖子

添加片段时,会出现"错误的第二个参数类型"错误

我检查了类似的帖子,他们的解决方案似乎不起作用.我(显然)对此很陌生,所以我可能只是缺乏技巧.

我收到错误:

"找到错误的第二个参数类型:'mycompany.fragment_test ... required:'android.support.v4.app.Fragment

replace(int,android.support.v4.ap.Fragment)to(int,mycompany.fragment_test ...)'

import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.os.Bundle;


public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (findViewById(R.id.fragment_container) != null) {
        if (savedInstanceState != null) {
            return;
        }

        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();

        Menu_Fragment fragment = new Menu_Fragment();
        fragment.setArguments(getIntent().getExtras());



        ft.replace(R.id.fragment_container, fragment); //This is the line with the issue
        ft.commit();

    }

  }
}
Run Code Online (Sandbox Code Playgroud)

android android-fragments

2
推荐指数
1
解决办法
3440
查看次数

按下按钮时出现div

div按下按钮时,我无法显示所选内容并消失.

<button id="showButton" type="button">Show More</button>

<div id="container">
    <div id="fourthArticle">
        <img class="row1pic" id="pic4" src="../Pictures/Gamerati/00-Shub-Niggurath-Rampage.jpg" alt="Freud everyone!">
       <p>
       <span style="font-weight:bold;">This is a third article</span>
       this is the content of the article. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
       </p>
    </div>

    <div id="fifthArticle">
        <img class="row1pic" id="pic5" src="../Pictures/Gamerati/00-Shub-Niggurath-Rampage.jpg" alt="Freud everyone!">
       <p>
       <span style="font-weight:bold;">This is a third article</span>   
       this is the content of the article. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
       </p>
    </div>

    <div id="sixthArticle">
        <img class="row1pic" id="pic6" src="../Pictures/Gamerati/00-Shub-Niggurath-Rampage.jpg" …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

-1
推荐指数
1
解决办法
83
查看次数

标签 统计

android ×1

android-fragments ×1

css ×1

html ×1

javascript ×1

jquery ×1