本文整理汇总了Java中com.jeremyfeinstein.slidingmenu.example.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.jeremyfeinstein.slidingmenu.example包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onListItemClick
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onListItemClick(ListView lv, View v, int position, long id) {
Fragment newContent = null;
switch (position) {
case 0:
newContent = new ColorFragment(R.color.red);
break;
case 1:
newContent = new ColorFragment(R.color.green);
break;
case 2:
newContent = new ColorFragment(R.color.blue);
break;
case 3:
newContent = new ColorFragment(android.R.color.white);
break;
case 4:
newContent = new ColorFragment(android.R.color.black);
break;
}
if (newContent != null)
switchFragment(newContent);
}
示例2: onCreateView
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mPos == -1 && savedInstanceState != null)
mPos = savedInstanceState.getInt("mPos");
TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
mImgRes = imgs.getResourceId(mPos, -1);
GridView gv = (GridView) inflater.inflate(R.layout.list_grid, null);
gv.setBackgroundResource(android.R.color.black);
gv.setAdapter(new GridAdapter());
gv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
if (getActivity() == null)
return;
ResponsiveUIActivity activity = (ResponsiveUIActivity) getActivity();
activity.onBirdPressed(mPos);
}
});
return gv;
}
示例3: onCreate
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Above View
if (savedInstanceState != null)
mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
if (mContent == null)
mContent = new ColorFragment(R.color.red);
// set the Above View
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, mContent)
.commit();
// set the Behind View
setBehindContentView(R.layout.menu_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame, new ColorMenuFragment())
.commit();
// customize the SlidingMenu
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
示例4: onOptionsItemSelected
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
toggle();
}
return super.onOptionsItemSelected(item);
}
示例5: switchContent
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
public void switchContent(final Fragment fragment) {
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
Handler h = new Handler();
h.postDelayed(new Runnable() {
public void run() {
getSlidingMenu().showContent();
}
}, 50);
}
示例6: onActivityCreated
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String[] colors = getResources().getStringArray(R.array.color_names);
ArrayAdapter<String> colorAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, android.R.id.text1, colors);
setListAdapter(colorAdapter);
}
示例7: getView
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.grid_item, null);
}
ImageView img = (ImageView) convertView.findViewById(R.id.grid_item_img);
img.setImageResource(mImgRes);
return convertView;
}
示例8: onCreate
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int pos = 0;
if (getIntent().getExtras() != null) {
pos = getIntent().getExtras().getInt("pos");
}
String[] birds = getResources().getStringArray(R.array.birds);
TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
int resId = imgs.getResourceId(pos, -1);
setTitle(birds[pos]);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
ColorDrawable color = new ColorDrawable(Color.BLACK);
color.setAlpha(128);
getSupportActionBar().setBackgroundDrawable(color);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mHandler = new Handler();
ImageView imageView = new ImageView(this);
imageView.setScaleType(ScaleType.CENTER_INSIDE);
imageView.setImageResource(resId);
imageView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
getSupportActionBar().show();
hideActionBarDelayed(mHandler);
}
});
setContentView(imageView);
this.getWindow().setBackgroundDrawableResource(android.R.color.black);
}
示例9: onOptionsItemSelected
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
示例10: switchContent
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
public void switchContent(Fragment fragment) {
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
getSlidingMenu().showContent();
}
示例11: onActivityCreated
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String[] birds = getResources().getStringArray(R.array.birds);
ArrayAdapter<String> colorAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, android.R.id.text1, birds);
setListAdapter(colorAdapter);
}
示例12: CustomZoomAnimation
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
public CustomZoomAnimation() {
// see the class CustomAnimation for how to attach
// the CanvasTransformer to the SlidingMenu
super(R.string.anim_zoom, new CanvasTransformer() {
@Override
public void transformCanvas(Canvas canvas, float percentOpen) {
float scale = (float) (percentOpen*0.25 + 0.75);
canvas.scale(scale, scale, canvas.getWidth()/2, canvas.getHeight()/2);
}
});
}
示例13: onCreate
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Above View
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new SampleListFragment())
.commit();
SlidingMenu sm = getSlidingMenu();
setSlidingActionBarEnabled(true);
sm.setBehindScrollScale(0.0f);
sm.setBehindCanvasTransformer(mTransformer);
}
示例14: CustomScaleAnimation
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
public CustomScaleAnimation() {
super(R.string.anim_scale, new CanvasTransformer() {
@Override
public void transformCanvas(Canvas canvas, float percentOpen) {
canvas.scale(percentOpen, 1, 0, 0);
}
});
}
示例15: CustomSlideAnimation
import com.jeremyfeinstein.slidingmenu.example.R; //导入依赖的package包/类
public CustomSlideAnimation() {
// see the class CustomAnimation for how to attach
// the CanvasTransformer to the SlidingMenu
super(R.string.anim_slide, new CanvasTransformer() {
@Override
public void transformCanvas(Canvas canvas, float percentOpen) {
canvas.translate(0, canvas.getHeight()*(1-interp.getInterpolation(percentOpen)));
}
});
}