중요한 문제에 직면하고 있습니다. 스크롤 시간에 목록의 배경색 (투명)을 변경하려고하지만이를 수행 할 수 없습니다. 나는 XML에 의해 listView뿐만 아니라 코드에 의해 변경하려고했습니다. 두 조건 모두 목록 배경이 하얀색이됩니다. android.support.v4.app.ListFragment;를 사용하고 있습니다. 및 FragmentPagerAdapter.android.support.v4.app.ListFragment를 사용하면 스크롤 할 때 목록의 배경색이 흰색이됩니다.
목록 스크롤 시간의 색상 변경을 변경하고 싶습니다. 이것을 위해 나는 다음 코드를 사용하고있다.
public static class ArrayListFragment extends ListFragment {
int mNum;
/**
* Create a new instance of CountingFragment, providing "num"
* as an argument.
*/
static ArrayListFragment newInstance(int num) {
ArrayListFragment f = new ArrayListFragment();
// Supply num input as an argument.
Bundle args = new Bundle();
args.putInt("num", num);
f.setArguments(args);
return f;
}
/**
* When creating, retrieve this instance's number from its arguments.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mNum = getArguments() != null ? getArguments().getInt("num") : 1;
}
/**
* The Fragment's UI is just a simple text view showing its
* instance number.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_pager_list, container, false);
//v.setBackgroundResource(R.drawable.background);
View tv = v.findViewById(R.id.text);
((TextView)tv).setText(frameName());
return v;
}
// @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_checked, RishavArraylist()));
}
런타임시 스크롤 목록의 배경을 어떻게 바꿀 수 있습니까? 고맙습니다.
감사
처럼 또는 XML을 통해 프로그래밍을 통해 투명하게 배경을 설정할 수 있습니다,이 문제에 대한 많은 옵션을 가지고있다. 자사의 작업 :) –