大佬教程收集整理的这篇文章主要介绍了android – 错误:computeFrames选项不支持JSR / RET,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的主要活动:
package piestudio.opinion; import android.os.bundle; import android.support.design.widget.FloaTingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.Fragmenttransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; public class MainActivity extends AppCompatActivity implements NavigationView.onNavigationItemSELEctedListener { /** * ATTENTION: This was auto-generated to implement the App Indexing API. * See https://g.co/AppIndexing/Androidstudio for more information. */ private GoogleApiClient client; @Override protected void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloaTingActionButton fab = (FloaTingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.onClickListener() { @Override public void onClick(View view) { Snackbar.make(view,"replace with your own action",Snackbar.LENGTH_LONG) .setAction("Action",null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this,drawer,toolbar,R.String.navigation_drawer_open,R.String.navigation_drawer_closE); drawer.setDrawerListener(togglE); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSELEctedListener(this); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/Androidstudio for more information. client = new GoogleApiClient.builder(this).addApi(AppIndex.API).build(); } @Override public void onBACkPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBACkPressed(); } } @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; } @Override public Boolean onOptionsItemSELEcted(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button,so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_setTings) { return true; } return super.onOptionsItemSELEcted(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public Boolean onNavigationItemSELEcted(MenuItem item) { int id = item.getItemId(); if (id == R.id.toi) { Fragment fragment = new Fragment(); Fragmenttransaction ft = getSupportFragmentManager().begintransaction(); ft.replace(R.id.content_frame,fragment); ft.commit(); return true; } else if (id == R.id.thehindu) { } else if (id == R.id.support) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
package piestudio.opinion; import android.support.v4.app.FragmentActivity; import android.view.Menu; /** * Created by jene on 7/4/2016. */ public class FragmentOne extends FragmentActivity { @Override public Boolean onCreateOptionsMenu(Menu menu) { return super.onCreateOptionsMenu(menu); } }
因为我正在使用导航抽屉,所以这里是我的contentMain
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://scheR_681_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_681_11845@as.android.com/apk/res-auto" xmlns:tools="http://scheR_681_11845@as.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layouT_Behavior="@String/appbar_scrolling_view_behavior" tools:context="piestudio.opinion.MainActivity" tools:showIn="@layout/app_bar_main"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/content_frame"/> </RelativeLayout>
fragment1(FragmentOne的xml文件)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/fragment1" xmlns:android="http://scheR_681_11845@as.android.com/apk/res/android"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="one" /> </LinearLayout>
以上是大佬教程为你收集整理的android – 错误:computeFrames选项不支持JSR / RET全部内容,希望文章能够帮你解决android – 错误:computeFrames选项不支持JSR / RET所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。