本文整理匯總了Java中android.view.View.setDuplicateParentStateEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java View.setDuplicateParentStateEnabled方法的具體用法?Java View.setDuplicateParentStateEnabled怎麽用?Java View.setDuplicateParentStateEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.setDuplicateParentStateEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: changeAdapter
import android.view.View; //導入方法依賴的package包/類
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = this.mTagAdapter;
HashSet preCheckedList = this.mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
TagView tagViewContainer = new TagView(getContext());
tagView.setDuplicateParentStateEnabled(true);
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(Integer.valueOf(i))) {
tagViewContainer.setChecked(true);
}
}
this.mSelectedView.addAll(preCheckedList);
}
示例2: dispatchChildren
import android.view.View; //導入方法依賴的package包/類
/**
* 設置子視圖與父控件perssed 等狀態保持一致
*
* @param view 各級子控件
*/
private void dispatchChildren(View view) {
// 子視圖與父控件perssed 等狀態保持一致
view.setDuplicateParentStateEnabled(true);
if (view instanceof ViewGroup && ((ViewGroup) view).getChildCount() > 0) {
for (int i = 0; i < getChildCount(); i++) {
dispatchChildren(((ViewGroup) view).getChildAt(i));
}
}
}
示例3: changeAdapter
import android.view.View; //導入方法依賴的package包/類
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null) {
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else {
ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i)) {
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i))) {
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}
示例4: changeAdapter
import android.view.View; //導入方法依賴的package包/類
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
// ViewGroup.MarginLayoutParams clp = (ViewGroup.MarginLayoutParams) tagView.getLayoutParams();
// ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(clp);
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.topMargin = clp.topMargin;
// lp.bottomMargin = clp.bottomMargin;
// lp.leftMargin = clp.leftMargin;
// lp.rightMargin = clp.rightMargin;
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null) {
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else {
MarginLayoutParams lp = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i)) {
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i))) {
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}
示例5: changeAdapter
import android.view.View; //導入方法依賴的package包/類
private void changeAdapter()
{
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++)
{
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
// ViewGroup.MarginLayoutParams clp = (ViewGroup.MarginLayoutParams) tagView.getLayoutParams();
// ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(clp);
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.topMargin = clp.topMargin;
// lp.bottomMargin = clp.bottomMargin;
// lp.leftMargin = clp.leftMargin;
// lp.rightMargin = clp.rightMargin;
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null)
{
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else
{
MarginLayoutParams lp = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i))
{
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i)))
{
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}