本文整理汇总了Java中android.support.wear.widget.WearableLinearLayoutManager类的典型用法代码示例。如果您正苦于以下问题:Java WearableLinearLayoutManager类的具体用法?Java WearableLinearLayoutManager怎么用?Java WearableLinearLayoutManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WearableLinearLayoutManager类属于android.support.wear.widget包,在下文中一共展示了WearableLinearLayoutManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.wear.widget.WearableLinearLayoutManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile_list);
TextView header = findViewById(R.id.text_view_screen_header);
if (header != null) {
header.setText(getText(R.string.title_activity_profile_list));
}
mRecyclerView = findViewById(R.id.profile_list);
mRecyclerView.setEdgeItemsCenteringEnabled(true);
mRecyclerView.setLayoutManager(
new WearableLinearLayoutManager(this));
mRecyclerView.setHasFixedSize(true);
mSelectedProfileName = getIntent().getExtras().getString(ARG_SELECTED_PROFILE_NAME, "");
byte[] arr = getIntent().getExtras().getByteArray(ARG_PROFILES);
if (arr != null && arr.length > 0) {
try {
mProfiles = new TrackProfileInfoValue.ValueList(arr);
} catch (IOException e) {
Logger.logE(TAG, "profile info constructor failed", e);
finish();
}
}
mAdapter = new ProfileListAdapter(mProfiles.getStorables().toArray(new TrackProfileInfoValue[0]));
mRecyclerView.setAdapter(mAdapter);
// Enables Always-on
//setAmbientEnabled();
}
示例2: onCreate
import android.support.wear.widget.WearableLinearLayoutManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AmbientMode.attachAmbientSupport(this);
// Menu items
List<AppItem> items = new ArrayList<AppItem>();
items.add(
new AppItem(
getString(R.string.lists), R.drawable.lists_circle, ListsActivity.class));
items.add(
new AppItem(
getString(R.string.dialogs),
R.drawable.dialogs_circle,
DialogsActivity.class));
items.add(
new AppItem(
getString(R.string.progress),
R.drawable.progress_circle,
ProgressActivity.class));
items.add(
new AppItem(
getString(R.string.controls),
R.drawable.controls_circle,
ControlsActivity.class));
items.add(
new AppItem(
getString(R.string.notifications),
R.drawable.notifications_circle,
NotificationsActivity.class));
items.add(
new AppItem(
getString(R.string.accessibility),
R.drawable.accessibility_circle,
AccessibilityActivity.class));
MenuRecyclerViewAdapter appListAdapter = new MenuRecyclerViewAdapter(this, items);
WearableRecyclerView recyclerView = findViewById(R.id.main_recycler_view);
// Customizes scrolling so items farther away form center are smaller.
ScalingScrollLayoutCallback scalingScrollLayoutCallback = new ScalingScrollLayoutCallback();
recyclerView.setLayoutManager(
new WearableLinearLayoutManager(this, scalingScrollLayoutCallback));
recyclerView.setEdgeItemsCenteringEnabled(true);
recyclerView.setAdapter(appListAdapter);
}
示例3: getLayoutManager
import android.support.wear.widget.WearableLinearLayoutManager; //导入依赖的package包/类
public WearableLinearLayoutManager getLayoutManager() {
return mLayoutManager;
}