protected void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); requestWindowFeature(5); setContentView(2130968609); setProgressBarIndeterminateVisibility(false); this.search_button = ((Button)findViewById(2131558474)); this.cancel_button = ((Button)findViewById(2131558588)); this.device_listview = ((ListView)findViewById(2131558587));
时间: 2024-04-29 09:19:33 浏览: 16
这是一个 Android 应用程序的活动类中的 onCreate() 方法,它接收一个 Bundle 参数,并在该方法中完成了一些初始化工作。
首先,该方法调用了父类 Activity 的 onCreate() 方法,将接收到的 Bundle 参数传递给父类。然后,它调用了 requestWindowFeature() 方法,请求窗口特性,其中参数 5 表示该窗口具有进度条特性。
接下来,该方法调用了 setContentView() 方法,将布局文件的 ID 设置为 2130968609,用于设置当前活动的用户界面。
然后,该方法通过 findViewById() 方法获取了布局文件中的三个控件:search_button、cancel_button 和 device_listview,并将它们分别赋值给该类中的成员变量。
最后,该方法调用了 setProgressBarIndeterminateVisibility() 方法,将进度条特性设置为不可见状态。
相关问题
public class Weclome extends Activity { public static final long DELAY_TIME = 2000L; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.welcome); new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(Weclome.this, Login.class)); finish(); } }, DELAY_TIME); } }
这是一个Android应用程序的欢迎界面,代码中创建了一个继承自Activity的Weclome类。其中DELAY_TIME是一个常量,表示延迟时间为2000毫秒。在onCreate方法中,requestWindowFeature方法用来隐藏标题栏,setContentView方法用来设置布局文件。接着使用Handler类的postDelayed方法来实现延迟操作,当延迟时间到达后,会自动跳转到Login类的界面,并且销毁当前的Weclome界面。
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE );//设置当前窗体特征 setContentView(R.layout.chat_activity_main); fragmentManager=getSupportFragmentManager(); initView(); initFragment(); initEvent(); Fragment_select(0); //将第一个图标设为选中状态 imageView_chat.setImageResource(R.drawable.chat2); } @Override public void onClick(View view) { restartButton(); switch(view.getId()) { case R.id.chat: //选择所点击的菜单对应的图层片段 Fragment_select(0); //将该菜单的点击状态置为点击态 restartButton(); imageView_chat.setImageResource(R.drawable.chat2); break; case R.id.contacts: Fragment_select(1); restartButton(); imageView_contacts.setImageResource(R.drawable.contracts2); break; case R.id.circle_friend: Fragment_select(2); restartButton(); imageView_circleoffriend.setImageResource(R.drawable.circleoffriend2); break; case R.id.settings: Fragment_select(3); restartButton(); imageView_setting.setImageResource(R.drawable.setting2); break; default: break; } }
这是一段Java代码,实现了一个Android应用的主界面布局和点击事件处理。在onCreate方法中,首先调用父类的onCreate方法,并设置当前窗体特征为无标题,然后加载布局文件并获取FragmentManager实例,接着初始化界面和Fragment,并设置点击事件监听器。最后调用Fragment_select方法将第一个Fragment设为选中状态,并将第一个图标设为选中状态。在onClick方法中,根据点击的view的id选择对应的Fragment并设置对应的图标为选中状态。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)