本文整理汇总了Java中android.app.Fragment.setUserVisibleHint方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.setUserVisibleHint方法的具体用法?Java Fragment.setUserVisibleHint怎么用?Java Fragment.setUserVisibleHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Fragment
的用法示例。
在下文中一共展示了Fragment.setUserVisibleHint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPrimaryItem
import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object)
{
Fragment fragment = (Fragment) object;
if (fragment != mCurrentPrimaryItem)
{
if (mCurrentPrimaryItem != null)
{
mCurrentPrimaryItem.setMenuVisibility(false);
mCurrentPrimaryItem.setUserVisibleHint(false);
}
if (fragment != null)
{
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
}
mCurrentPrimaryItem = fragment;
}
}
示例2: instantiateItem
import android.app.Fragment; //导入方法依赖的package包/类
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
if (currentTransaction == null)
currentTransaction = fragmentManager.beginTransaction();
final String tag = (position == 0) ? TAG_LEFT : TAG_RIGHT;
final Fragment fragment = (position == 0) ? left : right;
currentTransaction.add(container.getId(), fragment, tag);
if (fragment != currentPrimaryItem) {
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
}
return fragment;
}
示例3: showMapUiLayout
import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void showMapUiLayout(Context context, RelativeLayout mapUI, Fragment mapFrag) {
if(isMapFragmentShowing){
return;
}
mapFrag.setUserVisibleHint(true);
Animation animation = AnimationUtils.loadAnimation(context, R.anim.scale_in);
mapUI.startAnimation(animation);
isMapFragmentShowing = true;
}
示例4: instantiateItem
import android.app.Fragment; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position)
{
if (mCurTransaction == null)
{
mCurTransaction = mFragmentManager.beginTransaction();
}
final long itemId = getItemId(position);
// Do we already have this fragment?
String name = makeFragmentName(container.getId(), itemId);
Fragment fragment = mFragmentManager.findFragmentByTag(name);
if (fragment != null)
{
if (DEBUG)
{
Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
}
mCurTransaction.attach(fragment);
}
else
{
fragment = getItem(position);
if (DEBUG)
{
Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
}
mCurTransaction.add(container.getId(), fragment,
makeFragmentName(container.getId(), itemId));
}
if (fragment != mCurrentPrimaryItem)
{
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
}
return fragment;
}
示例5: instantiateItem
import android.app.Fragment; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (currTransaction == null) {
currTransaction = fm.beginTransaction();
}
Fragment fragment = getExistingFragment(position);
if (fragment != null) {
retentionStrategy.attach(fragment, currTransaction);
} else {
fragment = createFragment(entries.get(position).getDescriptor());
currTransaction.add(container.getId(), fragment,
getFragmentTag(position));
}
if (fragment != currPrimaryItem) {
fragment.setMenuVisibility(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
fragment.setUserVisibleHint(false);
}
}
return (fragment);
}
示例6: setPrimaryItem
import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void setPrimaryItem(final ViewGroup container, final int position, final Object object) {
final Fragment fragment = (Fragment) object;
if (fragment != currentPrimaryItem) {
if (currentPrimaryItem != null) {
currentPrimaryItem.setMenuVisibility(false);
currentPrimaryItem.setUserVisibleHint(false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
}
currentPrimaryItem = fragment;
}
}