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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

兩個小代碼合在一起,有一個沒反應。

兩個小代碼合在一起,有一個沒反應。

幕_后 2016-10-03 18:30:43
package com.example.com;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.widget.TextView;import java.util.Random;? ? public class MainActivity extends Activity {? ? ? ? ? ? ? ? ??? ? ? ? protected void onCreate(Bundle savedInstanceState){? ? ? ? ?TextView tv;? ? ? ? ? ? ? String s, r = "";? ? ? ? ? ? ? int start = 6,end = 14; ??? ? ? ? super.onCreate(savedInstanceState);? ? ? ? setContentView(R.layout.activity_main);? ? ? ? tv = (TextView) findViewById(R.id.tvInfo2);? ? ? ? s = getResources().getString(R.string.info);? ? ? ? for(int i = 0;i<end - start;i++)? ? ? ? r=r+"*";? ? ? ? s =s.replace(s.substring(start, end),r);? ? ? ? tv.setText(s);? ? ? ? }? ?? //就是這行改背景顏色的沒反應 ? ? ?public class colorss extends Activity {? ? ?? ? ? ? ? ? protected void onCreate(Bundle savedInstanceState) {? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? super.onCreate(savedInstanceState);? ? ? ? ? ? ? ? setContentView(R.layout.activity_main);? ? ? ? ? ? ? ? int bgc[] = {R.color.gp1,? ? ? ? ? ? ? ? R.color.bg2,? ? ? ? ? ? ? ? R.color.bg3,? ? ? ? ? ? ? ? R.color.bg4,? ? ? ? ? ? ? ? R.color.bg5};? ? ? ? ? ? ? ? Random r= new Random();? ? ? ? ? ? ? ? int i = r.nextInt(bgc.length);? ? ? ? ? ? ? ? getWindow().setBackgroundDrawableResource(bgc[i]);}? ? ? ? ??? ? ? ? ? ?? ??? ? @Override? ? public boolean onCreateOptionsMenu(Menu menu) {? ? ? ? // Inflate the menu; this adds items to the action bar if it is present.? ? ? ? getMenuInflater().inflate(R.menu.main, menu);? ? ? ? return true;? ? }? ??}? ? }? ? ? ??
查看完整描述

3 回答

已采納
?
小羅希冀

TA貢獻13條經(jīng)驗 獲得超7個贊

你的意思是你在一個class文件上重寫了兩個onCreate()方法

查看完整回答
反對 回復 2016-10-03
?
l1l1l1l

TA貢獻1條經(jīng)驗 獲得超0個贊

如果你這些代碼在一個class里面自然就錯了 ?Activity是android四大組件之一,onCreate()方法是Activity的生命周期方法之一,activity也需要在清單文件中配置。你去看看activity的基礎應該就能找到問題了。

查看完整回答
反對 回復 2016-10-11
  • 3 回答
  • 0 關注
  • 1400 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號