本文整理汇总了Java中android.widget.ListView.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.setPadding方法的具体用法?Java ListView.setPadding怎么用?Java ListView.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setPadding方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PopMenu
import android.widget.ListView; //导入方法依赖的package包/类
public PopMenu(Context context, int resid, int checkedPosition, int height) {
this.context = context;
this.checkedPosition = checkedPosition;
itemList = new ArrayList<String>();
RelativeLayout view = new RelativeLayout(context);
// view.setBackgroundResource(resid);
listView = new ListView(context);
listView.setPadding(0, ParamsUtil.dpToPx(context, 3), 0, ParamsUtil.dpToPx(context, 3));
view.addView(listView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
listView.setAdapter(new PopAdapter());
listView.setOnItemClickListener(this);
popupWindow = new PopupWindow(view, context.getResources().getDimensionPixelSize(R.dimen.popmenu_width), height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
}
示例2: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
RelativeLayout downloadLayout = new RelativeLayout(activity.getApplicationContext());
downloadLayout.setBackgroundColor(Color.WHITE);
receiver = new DownloadedReceiver();
activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADED));
downloadedListView = new ListView(context);
downloadedListView.setPadding(10, 10, 10, 10);
downloadedListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams downloadedLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
downloadLayout.addView(downloadedListView, downloadedLayoutParams);
initData();
downloadedListView.setOnItemClickListener(onItemClickListener);
downloadedListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
return downloadLayout;
}
示例3: PlayChangeVideoPopupWindow
import android.widget.ListView; //导入方法依赖的package包/类
public PlayChangeVideoPopupWindow(Context context, int height) {
this.context = context;
RelativeLayout view = new RelativeLayout(context);
listView = new ListView(context);
listView.setPadding(0, ParamsUtil.dpToPx(context, 3), 0, ParamsUtil.dpToPx(context, 3));
view.addView(listView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
adapter = new VideosAdapter();
listView.setAdapter(adapter);
popupWindow = new PopupWindow(view, height * 2 / 3 , height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
}
示例4: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
getActionBar().setDisplayHomeAsUpEnabled(true);
RelativeLayout accountLayout = new RelativeLayout(this);
accountLayout.setBackgroundColor(Color.WHITE);
LayoutParams accountLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
accountLayout.setLayoutParams(accountLayoutParams);
ListView accountListView = new ListView(this);
accountListView.setPadding(10, 10, 10, 10);
accountListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams accountListViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
accountLayout.addView(accountListView, accountListViewParams);
List<Pair<String, String>> pairs = new ArrayList<Pair<String,String>>();
Pair<String, String> userIdPair = new Pair<String, String>("User ID",ConfigUtil.USERID);
pairs.add(userIdPair);
Pair<String, String> apiKeyPair = new Pair<String, String>("API Key", ConfigUtil.API_KEY);
pairs.add(apiKeyPair);
AccountViewAdapter accountViewAdapter = new AccountViewAdapter(this, pairs);
accountListView.setAdapter(accountViewAdapter);
setContentView(accountLayout);
super.onCreate(savedInstanceState);
}
示例5: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
receiver = new DownloadedReceiver();
activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADING));
RelativeLayout downloadRelativeLayout = new RelativeLayout(context);
downloadRelativeLayout.setBackgroundColor(Color.WHITE);
downloadRelativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
downloadListView = new ListView(context);
downloadListView.setPadding(10, 10, 10, 10);
downloadListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams listViewLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
downloadRelativeLayout.addView(downloadListView, listViewLayout);
// 生成动态数组,加入数据
pairs = new ArrayList<Pair<String,Integer>>();
for (int i = 0; i < downloadVideoIds.length; i++) {
Pair<String, Integer> pair = new Pair<String, Integer>(downloadVideoIds[i], R.drawable.download);
pairs.add(pair);
}
downloadListViewAdapter = new DownloadListViewAdapter(context, pairs);
downloadListView.setAdapter(downloadListViewAdapter);
downloadListView.setOnItemClickListener(onItemClickListener);
service = new Intent(context, DownloadService.class);
activity.bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
initDownloaderHashMap();
return downloadRelativeLayout;
}
示例6: initView
import android.widget.ListView; //导入方法依赖的package包/类
private void initView(RelativeLayout view ){
view.setBackgroundColor(Color.WHITE);
LayoutParams downloadingLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
downloadingListView = new ListView(context);
downloadingListView.setPadding(10, 10, 10, 10);
downloadingListView.setDivider(getResources().getDrawable(R.drawable.line));
view.addView(downloadingListView, downloadingLayoutParams);
downloadingListView.setOnItemClickListener(onItemClickListener);
downloadingListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
}
示例7: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
context = getActivity().getApplicationContext();
RelativeLayout playLayout = new RelativeLayout(context);
playLayout.setBackgroundColor(Color.WHITE);
LayoutParams playLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
playLayout.setLayoutParams(playLayoutParams);
playListView = new ListView(context);
playListView.setDivider(getResources().getDrawable(R.drawable.line));
playListView.setDividerHeight(2);
playListView.setPadding(10, 10, 10, 10);
LayoutParams playListLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
playLayout.addView(playListView, playListLayoutParams);
// 生成动态数组,加入数据
pairs = new ArrayList<Pair<String,Integer>>();
for (int i = 0; i < playVideoIds.length; i++) {
Pair<String, Integer> pair = new Pair<String, Integer>(playVideoIds[i], R.drawable.play);
pairs.add(pair);
}
videoListViewAdapter = new VideoListViewAdapter(context, pairs);
playListView.setAdapter(videoListViewAdapter);
playListView.setOnItemClickListener(onItemClickListener);
return playLayout;
}
示例8: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = super.onCreateView(inflater, container, savedInstanceState);
if (v != null) {
ListView lv = (ListView) v.findViewById(android.R.id.list);
lv.setPadding(0, 0, 0, 0);
}
return v;
}
示例9: makeCenterView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@NonNull
protected LinearLayout makeCenterView() {
LinearLayout rootLayout = new LinearLayout(activity);
rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
rootLayout.setOrientation(LinearLayout.VERTICAL);
mListView = new ListView(activity);
mListView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
mListView.getLayoutParams().height = screenHeightPixels/4;
mListView.setPadding(30, 10, 30, 10);
// 去掉分割线
mListView.setDividerHeight(0);
mListView.setAdapter(mWeekAdapter);
rootLayout.addView(mListView);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// 取得ViewHolder对象,这样就省去了通过层层的findViewById去实例化我们需要的cb实例的步骤
WeekAdapter.ViewHolder holder = (WeekAdapter.ViewHolder) arg1.getTag();
// 改变CheckBox的状态
holder.cb.toggle();
// 将CheckBox的选中状况记录下来
mWeekAdapter.setIsSelected(arg2, holder.cb.isChecked());
}
});
setTitleText(mTitle);
return rootLayout;
}