第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

TextSwitcherActivity,無(wú)法解析符號(hào)

TextSwitcherActivity,無(wú)法解析符號(hào)

我想向片段添加一個(gè)簡(jiǎn)單的 TextSwitcher,這一切都很好(我認(rèn)為)直到這一行:TextView t = new TextView (TextSwitcherActivity.this);我錯(cuò)過(guò)了為什么它無(wú)法解析符號(hào):TextSwitcherActivity。請(qǐng),如果您有任何建議,我將不勝感激。這是整個(gè) Java 代碼,我相信是書(shū)上的,沒(méi)什么新鮮的。public class viewOne extends AppCompatActivity {    TextSwitcher switching;    Button pre_button, next_button;    String strTextSwitcher[] = {"Text 1", "Text 2", "Text 3, Text 4", "Text demo 5"};    int currentIndex = -1;    @Override    protected void onCreate(Bundle savedInstanceState){        super.onCreate(savedInstanceState);        setContentView(R.layout.fragment_view_one);        next_button=(Button)findViewById(R.id.next_button);        pre_button=(Button)findViewById(R.id.pre_button);        switching=(TextSwitcher)findViewById(R.id.switching);        switching.setFactory(new ViewSwitcher.ViewFactory() {            public View makeView() {                TextView t = new TextView (TextSwitcherActivity.this);                t.setGravity(Gravity.TOP|Gravity.CENTER);                t.setTextSize(36);                return t;            }        });        switching.setCurrentText("click on the next button to switch text");        pre_button.setOnClickListener(new View.OnClickListener(){            @Override                    public void onClick(View view){                if (currentIndex>0)                    switching.setText(strTextSwitcher[currentIndex]);            }        });        next_button.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View view) {                if (currentIndex<strTextSwitcher.length-1)                    currentIndex = currentIndex+1;                switching.setText(strTextSwitcher[currentIndex]);            }        });    }}
查看完整描述

1 回答

?
慕田峪7331174

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊

嘗試


TextView t = new TextView (this);

//or

TextView t = new TextView (viewOne.this);


查看完整回答
反對(duì) 回復(fù) 2021-12-01
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)