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