편집 기록

편집 기록
  • 프로필김선우님의 편집
    날짜2016.09.09

    No adapter attached; skipping layout 에러입니다 너무 고생합니다 도와주십시오 ㅠㅠ


    public class frag extends ActionBarActivity{
        private LinearLayoutManager lLayout;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_frag);
            setTitle(null);
    
            Toolbar topToolBar = (Toolbar) findViewById(R.id.toolbar);
            setSupportActionBar(topToolBar);
            topToolBar.setLogo(R.drawable.logo);
            topToolBar.setLogoDescription(getResources().getString(R.string.logo_desc));
    
            List<Itemobject> rowListItem = getAllItemList();
            lLayout = new LinearLayoutManager(frag.this);
    
            RecyclerView rView = (RecyclerView) findViewById(R.id.recycler_view);
            rView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
            RecyclerViewAdapter rcAdapter = new RecyclerViewAdapter(frag.this, rowListItem);
            rView.setAdapter(rcAdapter);
        }
        public static class Main extends Fragment{
            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                     Bundle savedInstanceState) {
                return inflater.inflate(R.layout.activity_frag, null);
            }
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.menu_main, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
    
            int id = item.getItemId();
    
    
            if (id == R.id.action_settings) {
                return true;
            }
            if (id == R.id.action_refresh) {
                Toast.makeText(frag.this, "Refresh App", Toast.LENGTH_LONG).show();
            }
            if (id == R.id.action_new) {
                Toast.makeText(frag.this, "Create Text", Toast.LENGTH_LONG).show();
            }
    
            return super.onOptionsItemSelected(item);
        }
    
        private List<Itemobject> getAllItemList() {
    
            List<Itemobject> allItems = new ArrayList<Itemobject>();
            allItems.add(new Itemobject("United States", R.drawable.newyork));
            allItems.add(new Itemobject("Canada", R.drawable.canada));
            allItems.add(new Itemobject("United Kingdom", R.drawable.uk));
            allItems.add(new Itemobject("Germany", R.drawable.germany));
            allItems.add(new Itemobject("Sweden", R.drawable.sweden));
    
            return allItems;
        }
      }
    }
    
  • 프로필이지훈님의 편집
    날짜2016.09.09

    No adapter attached; skipping layout 에러입니다 너무 고생합니다 도와주십시오 ㅠㅠ


    public class frag extends ActionBarActivity{ private LinearLayoutManager lLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_frag); setTitle(null);

        Toolbar topToolBar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(topToolBar);
        topToolBar.setLogo(R.drawable.logo);
        topToolBar.setLogoDescription(getResources().getString(R.string.logo_desc));
    
        List<Itemobject> rowListItem = getAllItemList();
        lLayout = new LinearLayoutManager(frag.this);
    
        RecyclerView rView = (RecyclerView) findViewById(R.id.recycler_view);
        rView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
        RecyclerViewAdapter rcAdapter = new RecyclerViewAdapter(frag.this, rowListItem);
        rView.setAdapter(rcAdapter);
    }
    public static class Main extends Fragment{
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            return inflater.inflate(R.layout.activity_frag, null);
        }
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    
        int id = item.getItemId();
    
    
        if (id == R.id.action_settings) {
            return true;
        }
        if (id == R.id.action_refresh) {
            Toast.makeText(frag.this, "Refresh App", Toast.LENGTH_LONG).show();
        }
        if (id == R.id.action_new) {
            Toast.makeText(frag.this, "Create Text", Toast.LENGTH_LONG).show();
        }
    
        return super.onOptionsItemSelected(item);
    }
    
    private List<Itemobject> getAllItemList() {
    
        List<Itemobject> allItems = new ArrayList<Itemobject>();
        allItems.add(new Itemobject("United States", R.drawable.newyork));
        allItems.add(new Itemobject("Canada", R.drawable.canada));
        allItems.add(new Itemobject("United Kingdom", R.drawable.uk));
        allItems.add(new Itemobject("Germany", R.drawable.germany));
        allItems.add(new Itemobject("Sweden", R.drawable.sweden));
    
        return allItems;
    }
    

    } }

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 계정을 생성하셔야만 글을 작성하실 수 있습니다.