android.support.v7.widget.Toolbar.setPadding()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中android.support.v7.widget.Toolbar.setPadding()方法的一些代码示例,展示了Toolbar.setPadding()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setPadding()方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setPadding

Toolbar.setPadding介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

  1. @TargetApi(21)
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. final View rootView = inflater.inflate(
  5. R.layout.fragment_playlist_detail, container, false);
  6. albumArt = (ImageView) rootView.findViewById(R.id.album_art);
  7. albumTitle = (TextView) rootView.findViewById(R.id.album_title);
  8. albumDetails = (TextView) rootView.findViewById(R.id.album_details);
  9. albumArtSmall = (SimpleDraweeView) rootView.findViewById(R.id.albumArtSmall);
  10. toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
  11. toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()) / 2, 0, 0);
  12. recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
  13. collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
  14. appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
  15. //recyclerView.setEnabled(false);
  16. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  17. recyclerView.setHasFixedSize(true);
  18. setUpEverything();
  19. return rootView;
  20. }

代码示例来源:origin: aa112901/remusic

  1. private void setupToolbar() {
  2. setSupportActionBar(toolbar);
  3. actionBar = getSupportActionBar();
  4. actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
  5. actionBar.setDisplayHomeAsUpEnabled(true);
  6. actionBar.setTitle(artistName);
  7. toolbar.setPadding(0, mStatusSize, 0, 0);
  8. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. onBackPressed();
  12. }
  13. });
  14. toolbar.setSubtitle(artistDes);
  15. }

代码示例来源:origin: aa112901/remusic

  1. private void setupToolbar() {
  2. setSupportActionBar(toolbar);
  3. actionBar = getSupportActionBar();
  4. actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
  5. actionBar.setDisplayHomeAsUpEnabled(true);
  6. actionBar.setTitle("歌单");
  7. toolbar.setPadding(0, mStatusSize, 0, 0);
  8. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. onBackPressed();
  12. }
  13. });
  14. toolbar.setSubtitle(albumDes);
  15. }

代码示例来源:origin: aa112901/remusic

  1. private void setupToolbar() {
  2. setSupportActionBar(toolbar);
  3. actionBar = getSupportActionBar();
  4. actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
  5. actionBar.setDisplayHomeAsUpEnabled(true);
  6. actionBar.setTitle("歌单");
  7. toolbar.setPadding(0, mStatusSize, 0, 0);
  8. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. onBackPressed();
  12. }
  13. });
  14. toolbar.setSubtitle(albumDes);
  15. }

代码示例来源:origin: aa112901/remusic

  1. private void setupToolbar() {
  2. setSupportActionBar(toolbar);
  3. actionBar = getSupportActionBar();
  4. actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
  5. actionBar.setDisplayHomeAsUpEnabled(true);
  6. actionBar.setTitle("歌单");
  7. toolbar.setPadding(0, mStatusSize, 0, 0);
  8. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. onBackPressed();
  12. }
  13. });
  14. if (!isLocalPlaylist) {
  15. toolbar.setSubtitle(playlistDetail);
  16. }
  17. }

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  3. View view = inflater.inflate(R.layout.fragment_common, container, false);
  4. layoutManager = new LinearLayoutManager(mContext);
  5. recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
  6. recyclerView.setLayoutManager(layoutManager);
  7. folderDetailAdapter = new FolderDetailAdapter(null);
  8. recyclerView.setAdapter(folderDetailAdapter);
  9. setItemDecoration();
  10. reloadAdapter();
  11. recyclerView.setHasFixedSize(true);
  12. toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  13. ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
  14. toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
  15. ab = ((AppCompatActivity) mContext).getSupportActionBar();
  16. ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
  17. ab.setDisplayHomeAsUpEnabled(true);
  18. String folder = folder_path.substring(folder_path.lastIndexOf(File.separator), folder_path.length());
  19. ab.setTitle(folder.substring(folder.lastIndexOf(File.separator) + 1, folder.length()));
  20. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  21. @Override
  22. public void onClick(View v) {
  23. mContext.onBackPressed();
  24. }
  25. });
  26. return view;
  27. }

代码示例来源:origin: aa112901/remusic

  1. private void setupToolbar() {
  2. setSupportActionBar(toolbar);
  3. actionBar = getSupportActionBar();
  4. actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
  5. actionBar.setDisplayHomeAsUpEnabled(true);
  6. actionBar.setTitle("歌单");
  7. toolbar.setPadding(0, mStatusSize, 0, 0);
  8. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. onBackPressed();
  12. }
  13. });
  14. if (!isLocalPlaylist) {
  15. toolbar.setSubtitle(playlistDetail);
  16. }
  17. }

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  3. View view = inflater.inflate(R.layout.fragment_common, container, false);
  4. recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
  5. layoutManager = new LinearLayoutManager(mContext);
  6. recyclerView.setLayoutManager(layoutManager);
  7. artDetailAdapter = new ArtDetailAdapter(null);
  8. recyclerView.setAdapter(artDetailAdapter);
  9. recyclerView.setHasFixedSize(true);
  10. setItemDecoration();
  11. reloadAdapter();
  12. ArtistInfo artistInfo = MusicUtils.getArtistinfo(mContext, artistID);
  13. toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  14. toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
  15. ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
  16. ab = ((AppCompatActivity) mContext).getSupportActionBar();
  17. ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
  18. ab.setDisplayHomeAsUpEnabled(true);
  19. ab.setTitle(artistInfo.artist_name);
  20. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  21. @Override
  22. public void onClick(View v) {
  23. if(getActivity() != null)
  24. getActivity().onBackPressed();
  25. }
  26. });
  27. return view;
  28. }

代码示例来源:origin: aa112901/remusic

  1. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  2. View view = inflater.inflate(R.layout.fragment_common, container, false);
  3. recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
  4. layoutManager = new LinearLayoutManager(mContext);
  5. recyclerView.setLayoutManager(layoutManager);
  6. mAdapter = new AlbumDetailAdapter(null);
  7. recyclerView.setAdapter(mAdapter);
  8. itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
  9. recyclerView.addItemDecoration(itemDecoration);
  10. recyclerView.setHasFixedSize(true);
  11. reloadAdapter();
  12. AlbumInfo albumInfo = MusicUtils.getAlbumInfo(mContext, albumID);
  13. Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  14. toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
  15. ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
  16. ab = ((AppCompatActivity) mContext).getSupportActionBar();
  17. ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
  18. ab.setDisplayHomeAsUpEnabled(true);
  19. ab.setTitle(albumInfo.album_name);
  20. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  21. @Override
  22. public void onClick(View v) {
  23. if(getActivity() != null)
  24. getActivity().onBackPressed();
  25. }
  26. });
  27. return view;
  28. }

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public void onCreate(Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. setContentView(R.layout.activity_local_search);
  5. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  6. toolbar.setPadding(0, CommonUtils.getStatusHeight(this), 0, 0);
  7. setSupportActionBar(toolbar);
  8. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  9. // SystemBarTintManager tintManager = new SystemBarTintManager(this);
  10. // // enable status bar tint
  11. // tintManager.setStatusBarTintEnabled(true);
  12. // // enable navigation bar tint
  13. // tintManager.setNavigationBarTintEnabled(true);
  14. mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  15. recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
  16. recyclerView.setLayoutManager(new LinearLayoutManager(this));
  17. recyclerView.setHasFixedSize(true);
  18. adapter = new SearchAdapter(this);
  19. recyclerView.setAdapter(adapter);
  20. }

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public void onCreate(Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. setContentView(R.layout.activity_net_search);
  5. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  6. toolbar.setPadding(0, CommonUtils.getStatusHeight(this), 0, 0);
  7. setSupportActionBar(toolbar);
  8. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  9. SearchHotWordFragment f = new SearchHotWordFragment();
  10. f.searchWords(NetSearchWordsActivity.this);
  11. FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
  12. ft.add(R.id.search_frame, f);
  13. ft.commit();
  14. mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  15. }

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  3. View view = inflater.inflate(R.layout.fragment_recent, container, false);
  4. TopTracksLoader recentloader = new TopTracksLoader(getActivity(), TopTracksLoader.QueryType.RecentSongs);
  5. List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
  6. int songCountInt = recentsongs.size();
  7. mList = recentsongs;
  8. recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
  9. layoutManager = new LinearLayoutManager(getActivity());
  10. recyclerView.setLayoutManager(layoutManager);
  11. toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  12. toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()), 0, 0);
  13. ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
  14. final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
  15. ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
  16. ab.setDisplayHomeAsUpEnabled(true);
  17. ab.setTitle("最近播放");
  18. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  19. @Override
  20. public void onClick(View v) {
  21. getActivity().onBackPressed();
  22. }
  23. });
  24. new loadSongs().execute("");
  25. return view;
  26. }

代码示例来源:origin: aa112901/remusic

  1. toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);

代码示例来源:origin: aa112901/remusic

  1. @Override
  2. public void onCreate(final Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. setContentView(R.layout.fragment_recent);
  5. // initQuickControls();
  6. recentStore = RecentStore.getInstance(this);
  7. TopTracksLoader recentloader = new TopTracksLoader(this, TopTracksLoader.QueryType.RecentSongs);
  8. List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
  9. int songCountInt = recentsongs.size();
  10. mList = recentsongs;
  11. recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
  12. layoutManager = new LinearLayoutManager(this);
  13. recyclerView.setLayoutManager(layoutManager);
  14. recyclerView.setHasFixedSize(true);
  15. toolbar = (Toolbar) findViewById(R.id.toolbar);
  16. toolbar.setPadding(0, CommonUtils.getStatusHeight(RecentActivity.this), 0, 0);
  17. setSupportActionBar(toolbar);
  18. final ActionBar ab = getSupportActionBar();
  19. ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
  20. ab.setDisplayHomeAsUpEnabled(true);
  21. ab.setTitle("最近播放");
  22. toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  23. @Override
  24. public void onClick(View v) {
  25. onBackPressed();
  26. }
  27. });
  28. new loadSongs().execute("");
  29. }

代码示例来源:origin: aa112901/remusic

  1. toolbar.setPadding(0, CommonUtils.getStatusHeight(DownActivity.this), 0, 0);
  2. setSupportActionBar(toolbar);
  3. final ActionBar ab = getSupportActionBar();

代码示例来源:origin: aa112901/remusic

  1. toolbar.setPadding(0, CommonUtils.getStatusHeight(this) / 2, 0, 0);

代码示例来源:origin: chaychan/TouTiao

  1. lp.height += statusBarHeight;
  2. toolbar.setLayoutParams(lp);
  3. toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
  4. toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

  1. lp.height += statusBarHeight;
  2. toolbar.setLayoutParams(lp);
  3. toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
  4. toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

  1. lp.height += statusBarHeight;
  2. toolbar.setLayoutParams(lp);
  3. toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
  4. toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

  1. lp.height += statusBarHeight;
  2. toolbar.setLayoutParams(lp);
  3. toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
  4. toolbar.setTag(true);

相关文章

Toolbar类方法