本文整理匯總了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);
}
});
}
示例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);
}
}
}
示例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;
}