當前位置: 首頁>>代碼示例>>Java>>正文


Java LinearLayout.getParent方法代碼示例

本文整理匯總了Java中android.widget.LinearLayout.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.getParent方法的具體用法?Java LinearLayout.getParent怎麽用?Java LinearLayout.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.LinearLayout的用法示例。


在下文中一共展示了LinearLayout.getParent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createListenerLog

import android.widget.LinearLayout; //導入方法依賴的package包/類
static void createListenerLog(LinearLayout messagesContainer, String text) {
    String currentDateTime = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault()).format(new Date());
    TextView textView = new TextView(messagesContainer.getContext());
    textView.setTextColor(Color.WHITE);
    textView.setTextSize(14);
    textView.setText(currentDateTime + ": " + text);

    messagesContainer.addView(textView);
    final ScrollView scrollView = (ScrollView)messagesContainer.getParent();
    scrollView.post(new Runnable() {
        public void run() {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });
}
 
開發者ID:JakeSteam,項目名稱:Vidsta,代碼行數:16,代碼來源:ListenerHelper.java

示例2: onClick

import android.widget.LinearLayout; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
    if (v instanceof ImageView) {//onClick CloseIcon
        //v.getParent() -> parent of closeIcon
        LinearLayout lnlChild = (LinearLayout) v.getParent();
        LinearLayout lnlContainer = (LinearLayout) lnlChild.getParent();
        int pillPosition = (int) (lnlContainer).getTag();

        if (onPillClickListener != null) {
            onPillClickListener.onCloseIconClick(this, pillPosition);
        }

    } else {
        //onClick for lnlContainer
        int linearLayoutPosition = (int) v.getTag();
        PillEntity pillEntity = (PillEntity) (objectList.get(linearLayoutPosition));
        if (selectionMode == DEFAULT_MODE_MULTI_SELECTION) {
            if (pillEntity.isPressed()) {
                pillEntity.setPressed(false);
                v.setBackgroundResource(backgroundPill);
            } else {
                pillEntity.setPressed(true);
                v.setBackgroundResource(backgroundPillSelected);
            }
        }
        if (onPillClickListener != null) {
            onPillClickListener.onPillClick(this, linearLayoutPosition);
        }
    }
}
 
開發者ID:orbismobile,項目名稱:android-MaterialPillsBox,代碼行數:31,代碼來源:MaterialPillsBox.java

示例3: getLayoutDepth

import android.widget.LinearLayout; //導入方法依賴的package包/類
/**
 * Procedure returns the layout depth of this term related to mainView
 */
public static int getLayoutDepth(LinearLayout l)
{
    int retValue = 0;
    if (l == null)
    {
        return retValue;
    }
    ViewParent p = l.getParent();
    while (p != null)
    {
        if (p instanceof TwoDScrollView)
        {
            if (((TwoDScrollView) p).getId() == R.id.main_scroll_view)
            {
                break;
            }
        }
        if (p instanceof FormulaBase && p.getParent() == null)
        {
            retValue += 2;
            break;
        }
        retValue++;
        p = p.getParent();
    }
    return retValue;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:31,代碼來源:ViewUtils.java


注:本文中的android.widget.LinearLayout.getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。