本文整理匯總了Java中android.widget.LinearLayout.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.setFocusable方法的具體用法?Java LinearLayout.setFocusable怎麽用?Java LinearLayout.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.setFocusable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createApplications
import android.widget.LinearLayout; //導入方法依賴的package包/類
private void createApplications() {
mContainer.removeAllViews();
mGridX = mSetup.getGridX();
mGridY = mSetup.getGridY();
if (mGridX < 2)
mGridX = 2;
if (mGridY < 1)
mGridY = 1;
int marginX = Utils.getPixelFromDp(getContext(), mSetup.getMarginX());
int marginY = Utils.getPixelFromDp(getContext(), mSetup.getMarginY());
boolean showNames = mSetup.showNames();
mApplications = new ApplicationView[mGridY][mGridX];
int position = 0;
for (int y = 0; y < mGridY; y++) {
LinearLayout ll = new LinearLayout(getContext());
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setGravity(Gravity.CENTER_VERTICAL);
ll.setFocusable(false);
ll.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, 0, 1
));
for (int x = 0; x < mGridX; x++) {
ApplicationView av = new ApplicationView(getContext());
av.setOnClickListener(this);
av.setOnLongClickListener(this);
av.setOnMenuOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLongClick(v);
}
});
av.setPosition(position++);
av.showName(showNames);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
av.setId(0x00FFFFFF + position);
} else {
av.setId(View.generateViewId());
}
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1);
lp.setMargins(marginX, marginY, marginX, marginY);
av.setLayoutParams(lp);
ll.addView(av);
mApplications[y][x] = av;
}
mContainer.addView(ll);
}
updateApplications();
setApplicationOrder();
}