本文整理汇总了Java中android.widget.LinearLayout.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.setVisibility方法的具体用法?Java LinearLayout.setVisibility怎么用?Java LinearLayout.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.setVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPreviewColor
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setPreviewColor() {
if (mView == null) return;
ImageView iView = new ImageView(getContext());
LinearLayout widgetFrameView = ((LinearLayout)mView.findViewById(android.R.id.widget_frame));
if (widgetFrameView == null) return;
widgetFrameView.setVisibility(View.VISIBLE);
widgetFrameView.setPadding(
widgetFrameView.getPaddingLeft(),
widgetFrameView.getPaddingTop(),
(int)(mDensity * 8),
widgetFrameView.getPaddingBottom()
);
// remove already create preview image
int count = widgetFrameView.getChildCount();
if (count > 0) {
widgetFrameView.removeViews(0, count);
}
widgetFrameView.addView(iView);
widgetFrameView.setMinimumWidth(0);
iView.setBackground(new AlphaPatternDrawable((int)(5 * mDensity)));
iView.setImageBitmap(getPreviewBitmap());
}
示例2: onCreateView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.activity_feedback, container, false);
((MainActivity) getActivity()).setActionBarTitle("Your Experience");
LinearLayout errorLayout = (LinearLayout)v.findViewById(R.id.error);
LinearLayout contLayout = (LinearLayout)v.findViewById(R.id.content);
if (!com.geca.wings.NetworkUtil.isNetworkConnected(getActivity())){
errorLayout.setVisibility(View.VISIBLE);
contLayout.setVisibility(View.GONE);
}else {
webView = (WebView) v.findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("http://goo.gl/forms/lKKl8xbKlz");
}
return v;
}
示例3: changeFolder
import android.widget.LinearLayout; //导入方法依赖的package包/类
public void changeFolder(long id) {
KRFAM.log("MainActivity.java > changeFolder");
CURRENT_FOLDER = id;
KRFAM.sharedPreferences.edit().putLong("CURRENT_FOLDER", CURRENT_FOLDER).commit();
CURRENT_OFFSET = 0;
TextView currentFolder_textView = (TextView) findViewById(R.id.folder_currentFolder);
TextView currentCount_textView = (TextView) findViewById(R.id.folder_currentCount);
if (CURRENT_FOLDER == -1) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
findViewById(R.id.folder_currentWrapper).setVisibility(View.GONE);
} else {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
findViewById(R.id.folder_currentWrapper).setVisibility(View.VISIBLE);
currentFolder_textView.setText(getPathToFolder(CURRENT_FOLDER));
currentFolder_textView.setSelected(true);
currentCount_textView.setText("" + db.countAccounts(CURRENT_FOLDER, "", false));
}
LinearLayout searchBar = (LinearLayout) findViewById(R.id.view_search);
searchBar.setVisibility(View.GONE);
getCurrentPage();
}
示例4: onCreateView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
View view = inflater.inflate(R.layout.fragment_reset_password, container, false);
tilResetEmail = (DCTextInputLayout) view.findViewById(R.id.til_reset_email);
tietResetEmail = (DCTextInputEditText) view.findViewById(R.id.tiet_reset_email);
btnResetSend = (DCButton) view.findViewById(R.id.btn_reset_send);
btnResetSend.setOnClickListener(this);
tvResetSuccess = (DCTextView) view.findViewById(R.id.tv_reset_success);
tvResetSuccess.setVisibility(View.GONE);
llResetPassword = (LinearLayout) view.findViewById(R.id.ll_reset_password);
llResetPassword.setVisibility(View.VISIBLE);
btnResetOk = (DCButton) view.findViewById(R.id.btn_reset_ok);
btnResetOk.setOnClickListener(this);
btnResetOk.setVisibility(View.GONE);
return view;
}
示例5: initViews
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initViews() {
mLayoutRoot = (LinearLayout) findViewById(R.id.dialog_generic_layout_root);
mLayoutTop = (LinearLayout) findViewById(R.id.dialog_generic_layout_top);
mLayoutTitle = (LinearLayout) findViewById(R.id.dialog_generic_layout_title);
mHtvTitle = (HandyTextView) findViewById(R.id.dialog_generic_htv_title);
mViewTitleLine = findViewById(R.id.dialog_generic_view_titleline);
mLayoutContent = (LinearLayout) findViewById(R.id.dialog_generic_layout_content);
mHtvMessage = (HandyTextView) findViewById(R.id.dialog_generic_htv_message);
mLayoutBottom = (LinearLayout) findViewById(R.id.dialog_generic_layout_bottom);
mBtnButton1 = (Button) findViewById(R.id.dialog_generic_btn_button1);
mBtnButton2 = (Button) findViewById(R.id.dialog_generic_btn_button2);
mBtnButton3 = (Button) findViewById(R.id.dialog_generic_btn_button3);
mLayoutRoot.setVisibility(View.VISIBLE);
setTitleLineVisibility(View.VISIBLE);
}
示例6: b3
import android.widget.LinearLayout; //导入方法依赖的package包/类
public void b3(View view)
{
LinearLayout btnTwo = (LinearLayout) findViewById(R.id.mainLinearLayout1);
if (isVisible)
{
isVisible = false;
btnTwo.setVisibility(View.VISIBLE);
//isVisible=true;
}
else
{
isVisible = true;
btnTwo.setVisibility(View.GONE);
}
}
示例7: onViewCreated
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState != null) {
mHeaderDisplay = savedInstanceState
.getInt(KEY_HEADER_POSITIONING,
getResources().getInteger(R.integer.default_header_display));
mAreMarginsFixed = savedInstanceState
.getBoolean(KEY_MARGINS_FIXED,
getResources().getBoolean(R.bool.default_margins_fixed));
} else {
mHeaderDisplay = getResources().getInteger(R.integer.default_header_display);
mAreMarginsFixed = getResources().getBoolean(R.bool.default_margins_fixed);
}
db = FlashcardDb.getInstance(getActivity().getApplicationContext());
flashcards = db.getAllFlashcards();
Log.d(TAG, "onViewCreated: flashcards.size() = " + flashcards.size());
rv.setLayoutManager(new LayoutManager(getActivity()));
//OverScrollDecoratorHelper.setUpOverScroll(rv, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
adapter = new RVMainAdapter(getActivity(), mHeaderDisplay, Utils.getFlashcardsByLabel(flashcards, getString(R.string.menu_dictionary)));
adapter.setMarginsFixed(mAreMarginsFixed);
adapter.setHeaderDisplay(mHeaderDisplay);
rv.setAdapter(new ScaleInAnimationAdapter(new AlphaInAnimationAdapter(adapter)));
LinearLayout noSets = (LinearLayout)view.findViewById(R.id.no_sets);
if (Utils.getFlashcardsByLabel(flashcards, getString(R.string.menu_dictionary)).isEmpty())
noSets.setVisibility(View.VISIBLE);
else
noSets.setVisibility(View.GONE);
}
示例8: checkIfEmpty
import android.widget.LinearLayout; //导入方法依赖的package包/类
public void checkIfEmpty() {
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.centerLayout);
if (blacklistedApp.getBlacklistedAppList().isEmpty()) {
linearLayout.setVisibility(View.VISIBLE);
} else {
linearLayout.setVisibility(View.GONE);
}
}
示例9: changeFragmentForTablets
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
if (newFragmentType == FragmentsAvailable.DIALER) {
showStatusBar();
} else {
hideStatusBar();
}
}
emptyFragment = false;
LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if(newFragmentType == FragmentsAvailable.EMPTY){
ll.setVisibility(View.VISIBLE);
emptyFragment = true;
transaction.replace(R.id.fragmentContainer2, newFragment);
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
} else {
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
ll.setVisibility(View.VISIBLE);
if (newFragmentType == FragmentsAvailable.CONTACT_EDITOR) {
transaction.addToBackStack(newFragmentType.toString());
}
transaction.replace(R.id.fragmentContainer2, newFragment);
} else {
if (newFragmentType == FragmentsAvailable.EMPTY) {
ll.setVisibility(View.VISIBLE);
transaction.replace(R.id.fragmentContainer2, new EmptyFragment());
emptyFragment = true;
}
if (newFragmentType == FragmentsAvailable.DIALER
|| newFragmentType == FragmentsAvailable.ABOUT
|| newFragmentType == FragmentsAvailable.SETTINGS
|| newFragmentType == FragmentsAvailable.ACCOUNT_SETTINGS) {
ll.setVisibility(View.GONE);
} else {
ll.setVisibility(View.VISIBLE);
transaction.replace(R.id.fragmentContainer2, new EmptyFragment());
}
/*if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) {
if (newFragmentType.isRightOf(currentFragment)) {
transaction.setCustomAnimations(R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left, R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right);
} else {
transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left);
}
}*/
transaction.replace(R.id.fragmentContainer, newFragment);
}
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
currentFragment = newFragmentType;
if (newFragmentType == FragmentsAvailable.DIALER
|| newFragmentType == FragmentsAvailable.SETTINGS
|| newFragmentType == FragmentsAvailable.CONTACTS_LIST
|| newFragmentType == FragmentsAvailable.CHAT_LIST
|| newFragmentType == FragmentsAvailable.HISTORY_LIST) {
try {
getFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
} catch (IllegalStateException e) {
}
}
fragmentsHistory.add(currentFragment);
}
}
示例10: revealEditText
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void revealEditText(LinearLayout view) {
int cx = view.getRight() - 30;
int cy = view.getBottom() - 60;
int finalRadius = Math.max(view.getWidth(), view.getHeight());
Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
view.setVisibility(View.VISIBLE);
isEditTextVisible = true;
anim.start();
}
示例11: initDietCart
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initDietCart(int time_type, ArrayList<RecordFood> foodRcordList,
ArrayList<RecordPhoto> recordPhotoList, LinearLayout ll_card) {
if ((foodRcordList == null || foodRcordList.size() <= 0) && (recordPhotoList == null ||
recordPhotoList.size() <= 0)) {
ll_card.setVisibility(8);
return;
}
int i;
ll_card.setVisibility(0);
TextView tv_des = (TextView) ll_card.findViewById(R.id.tv_des);
((TextView) ll_card.findViewById(R.id.tv_time_type)).setText(FoodUtils.getDietName(this
.activity, time_type));
StringBuffer sb = new StringBuffer();
for (i = 0; i < foodRcordList.size(); i++) {
sb.append(String.format("%1$s%2$s%3$s, ", new Object[]{((RecordFood) foodRcordList
.get(i)).food_name, Float.valueOf(((RecordFood) foodRcordList.get(i)).amount)
, ((RecordFood) foodRcordList.get(i)).unit_name}));
this.totalDietCalory += food.calory;
}
for (i = 0; i < recordPhotoList.size(); i++) {
RecordPhoto photo = (RecordPhoto) recordPhotoList.get(i);
String str = "%1$s, ";
Object[] objArr = new Object[1];
objArr[0] = TextUtils.isEmpty(photo.name) ? "拍照记录" : photo.name;
sb.append(String.format(str, objArr));
if (photo.status != 1) {
this.totalDietCalory += photo.calory;
}
}
tv_des.setText(sb.subSequence(0, sb.lastIndexOf(",")).toString());
}
示例12: onCreateView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContext = getActivity();
View v;
if (mListMode) {
v = inflater.inflate(R.layout.projectlist_list, container, false);
} else {
v = inflater.inflate(R.layout.projectlist_grid, container, false);
}
// Get GridView and set adapter
mGrid = (FitRecyclerView) v.findViewById(R.id.gridprojects);
mGrid.setItemAnimator(new DefaultItemAnimator());
// set the empty state
mEmptyGrid = (LinearLayout) v.findViewById(R.id.empty_grid_view);
// checkEmptyState();
registerForContextMenu(mGrid);
if (mProjectFolder != "") loadFolder(mProjectFolder);
mBackToFolderButton = (ImageButton) v.findViewById(R.id.backToFolders);
mTxtParentFolder = (TextView) v.findViewById(R.id.parentFolder);
mTxtFolder = (TextView) v.findViewById(R.id.folder);
mFolderPath = (LinearLayout) v.findViewById(R.id.folderPath);
mSelectFolder = (LinearLayout) v.findViewById(R.id.select_folder);
mBackToFolderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventBus.getDefault().post(new Events.AppUiEvent("page", 1));
// show folderlist
// if (isShown)
// else
}
});
mIsTablet = getResources().getBoolean(R.bool.isTablet);
LinearLayout llFolderLocation = (LinearLayout) v.findViewById(R.id.folderLocation2);
if (mIsTablet) llFolderLocation.setVisibility(View.GONE);
// TODO add the bottom bar any day.....
mBottomBar = (LinearLayout) v.findViewById(R.id.bottombar);
mBottomBar.setVisibility(View.GONE);
/*
mBottomBar.setTranslationY(AndroidUtils.dpToPixels(mContext, 52));
mBottomBar.animate().translationY(AndroidUtils.dpToPixels(mContext, 0)).setDuration(5000).start();
*/
return v;
}
示例13: initNavigationViewHeader
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initNavigationViewHeader() {
if (WallpaperBoardApplication.getConfig().getNavigationViewHeader() ==
WallpaperBoardConfiguration.NavigationViewHeader.NONE) {
mNavigationView.removeHeaderView(mNavigationView.getHeaderView(0));
return;
}
String imageUrl = getResources().getString(R.string.navigation_view_header);
String titleText = getResources().getString(R.string.navigation_view_header_title);
View header = mNavigationView.getHeaderView(0);
HeaderView image = header.findViewById(R.id.header_image);
LinearLayout container = header.findViewById(R.id.header_title_container);
TextView title = header.findViewById(R.id.header_title);
TextView version = header.findViewById(R.id.header_version);
if (WallpaperBoardApplication.getConfig().getNavigationViewHeader() ==
WallpaperBoardConfiguration.NavigationViewHeader.MINI) {
image.setRatio(16, 9);
}
if (titleText.length() == 0) {
container.setVisibility(View.GONE);
} else {
title.setText(titleText);
try {
String versionText = "v" + getPackageManager()
.getPackageInfo(getPackageName(), 0).versionName;
version.setText(versionText);
} catch (Exception ignored) {}
}
if (ColorHelper.isValidColor(imageUrl)) {
image.setBackgroundColor(Color.parseColor(imageUrl));
return;
}
if (!URLUtil.isValidUrl(imageUrl)) {
imageUrl = "drawable://" + DrawableHelper.getResourceId(this, imageUrl);
}
ImageLoader.getInstance().displayImage(imageUrl, new ImageViewAware(image),
ImageConfig.getDefaultImageOptions(), new ImageSize(720, 720), null, null);
}
示例14: animateCharViews
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void animateCharViews(View[] viewsToAnimate,
final LinearLayout parentView, final EditText editText) {
// first, make sure the items are out of sight
// by moving them by their height (maybe use parent's height?)
for (View viewToAnimate : viewsToAnimate) {
int height = viewToAnimate.getHeight();
float y = viewToAnimate.getY();
viewToAnimate.setY(y + height);
}
// now the whole container can be visible since the views are clipped
parentView.setVisibility(View.VISIBLE);
for (int i = 0; i < viewsToAnimate.length; i++) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(
ObjectAnimator.ofFloat(viewsToAnimate[i], "translationY", 0));
animatorSet.setInterpolator(new SimpleSpringInterpolator());
animatorSet.setDuration(700);
animatorSet.setStartDelay(i * 100);
if (i == viewsToAnimate.length - 1) {
// when the last char finishes animating,
// hide parent container and show the EditText
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
parentView.removeAllViews();
parentView.setVisibility(View.GONE);
if (!TextUtils.isEmpty(editText.getText()))
editText.setSelection(editText.getText().length());
editText.setVisibility(View.VISIBLE);
}
});
}
animatorSet.start();
}
}
示例15: onCreateView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_profiletab2, container, false);
sharedPref = new SharedPref(getContext());
cardView = (CardView) view.findViewById(R.id.cardview);
textName = (TextView) view.findViewById(R.id.name);
textRollno = (TextView) view.findViewById(R.id.rollno);
textEmail = (TextView) view.findViewById(R.id.email);
rollnoLayout = (LinearLayout) view.findViewById(R.id.rollnoLayout);
if(savedInstanceState==null){
String name="",email="",rollNo="";
name=sharedPref.getUserName();
email=sharedPref.getUserEmail();
rollNo=sharedPref.getUserRollno();
if(!name.isEmpty() && !email.isEmpty()){
cardView.setVisibility(View.VISIBLE);
textName.setText(name);
textEmail.setText(email);
if(!rollNo.isEmpty()){
textRollno.setText(rollNo);
}
else {
rollnoLayout.setVisibility(View.GONE);
}
}
}
else{
cardView.setVisibility(View.VISIBLE);
if(savedInstanceState.getString(USER_NAME)!=null&&!savedInstanceState.getString(USER_NAME).isEmpty()){
textName.setText(savedInstanceState.getString(USER_NAME));
}
else {
textName.setVisibility(View.GONE);
}
if(savedInstanceState.getString(USER_EMAIL)!=null&&!savedInstanceState.getString(USER_EMAIL).isEmpty()){
textEmail.setText(savedInstanceState.getString(USER_EMAIL));
}
else {
textEmail.setVisibility(View.GONE);
}
if(savedInstanceState.getString(USER_ROLLNO)!=null&&!savedInstanceState.getString(USER_ROLLNO).isEmpty()){
textRollno.setText(savedInstanceState.getString(USER_ROLLNO));
}
else {
textRollno.setVisibility(View.GONE);
}
}
return view;
}