本文整理了Java中android.support.v7.widget.Toolbar.setPadding()
方法的一些代码示例,展示了Toolbar.setPadding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setPadding()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setPadding
暂无
代码示例来源:origin: aa112901/remusic
@TargetApi(21)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(
R.layout.fragment_playlist_detail, container, false);
albumArt = (ImageView) rootView.findViewById(R.id.album_art);
albumTitle = (TextView) rootView.findViewById(R.id.album_title);
albumDetails = (TextView) rootView.findViewById(R.id.album_details);
albumArtSmall = (SimpleDraweeView) rootView.findViewById(R.id.albumArtSmall);
toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()) / 2, 0, 0);
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
//recyclerView.setEnabled(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setHasFixedSize(true);
setUpEverything();
return rootView;
}
代码示例来源:origin: aa112901/remusic
private void setupToolbar() {
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(artistName);
toolbar.setPadding(0, mStatusSize, 0, 0);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
toolbar.setSubtitle(artistDes);
}
代码示例来源:origin: aa112901/remusic
private void setupToolbar() {
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("歌单");
toolbar.setPadding(0, mStatusSize, 0, 0);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
toolbar.setSubtitle(albumDes);
}
代码示例来源:origin: aa112901/remusic
private void setupToolbar() {
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("歌单");
toolbar.setPadding(0, mStatusSize, 0, 0);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
toolbar.setSubtitle(albumDes);
}
代码示例来源:origin: aa112901/remusic
private void setupToolbar() {
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("歌单");
toolbar.setPadding(0, mStatusSize, 0, 0);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
if (!isLocalPlaylist) {
toolbar.setSubtitle(playlistDetail);
}
}
代码示例来源:origin: aa112901/remusic
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
layoutManager = new LinearLayoutManager(mContext);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(layoutManager);
folderDetailAdapter = new FolderDetailAdapter(null);
recyclerView.setAdapter(folderDetailAdapter);
setItemDecoration();
reloadAdapter();
recyclerView.setHasFixedSize(true);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
String folder = folder_path.substring(folder_path.lastIndexOf(File.separator), folder_path.length());
ab.setTitle(folder.substring(folder.lastIndexOf(File.separator) + 1, folder.length()));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mContext.onBackPressed();
}
});
return view;
}
代码示例来源:origin: aa112901/remusic
private void setupToolbar() {
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.actionbar_back);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("歌单");
toolbar.setPadding(0, mStatusSize, 0, 0);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
if (!isLocalPlaylist) {
toolbar.setSubtitle(playlistDetail);
}
}
代码示例来源:origin: aa112901/remusic
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
artDetailAdapter = new ArtDetailAdapter(null);
recyclerView.setAdapter(artDetailAdapter);
recyclerView.setHasFixedSize(true);
setItemDecoration();
reloadAdapter();
ArtistInfo artistInfo = MusicUtils.getArtistinfo(mContext, artistID);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(artistInfo.artist_name);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(getActivity() != null)
getActivity().onBackPressed();
}
});
return view;
}
代码示例来源:origin: aa112901/remusic
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new AlbumDetailAdapter(null);
recyclerView.setAdapter(mAdapter);
itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
recyclerView.addItemDecoration(itemDecoration);
recyclerView.setHasFixedSize(true);
reloadAdapter();
AlbumInfo albumInfo = MusicUtils.getAlbumInfo(mContext, albumID);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(albumInfo.album_name);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(getActivity() != null)
getActivity().onBackPressed();
}
});
return view;
}
代码示例来源:origin: aa112901/remusic
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_local_search);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(this), 0, 0);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// SystemBarTintManager tintManager = new SystemBarTintManager(this);
// // enable status bar tint
// tintManager.setStatusBarTintEnabled(true);
// // enable navigation bar tint
// tintManager.setNavigationBarTintEnabled(true);
mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
adapter = new SearchAdapter(this);
recyclerView.setAdapter(adapter);
}
代码示例来源:origin: aa112901/remusic
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_net_search);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(this), 0, 0);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
SearchHotWordFragment f = new SearchHotWordFragment();
f.searchWords(NetSearchWordsActivity.this);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.search_frame, f);
ft.commit();
mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
}
代码示例来源:origin: aa112901/remusic
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recent, container, false);
TopTracksLoader recentloader = new TopTracksLoader(getActivity(), TopTracksLoader.QueryType.RecentSongs);
List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
int songCountInt = recentsongs.size();
mList = recentsongs;
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()), 0, 0);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("最近播放");
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
new loadSongs().execute("");
return view;
}
代码示例来源:origin: aa112901/remusic
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
代码示例来源:origin: aa112901/remusic
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_recent);
// initQuickControls();
recentStore = RecentStore.getInstance(this);
TopTracksLoader recentloader = new TopTracksLoader(this, TopTracksLoader.QueryType.RecentSongs);
List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
int songCountInt = recentsongs.size();
mList = recentsongs;
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(RecentActivity.this), 0, 0);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("最近播放");
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
new loadSongs().execute("");
}
代码示例来源:origin: aa112901/remusic
toolbar.setPadding(0, CommonUtils.getStatusHeight(DownActivity.this), 0, 0);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
代码示例来源:origin: aa112901/remusic
toolbar.setPadding(0, CommonUtils.getStatusHeight(this) / 2, 0, 0);
代码示例来源:origin: chaychan/TouTiao
lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);
代码示例来源:origin: chaychan/TouTiao
lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);
代码示例来源:origin: chaychan/TouTiao
lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);
代码示例来源:origin: chaychan/TouTiao
lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);
内容来源于网络,如有侵权,请联系作者删除!