当我调用片段时,我试图模糊背景,但是它没有用。我使用set alpha但我的应用程序崩溃了
public class IDs{
public string someID{ get; set; }
public IDs(string someId){
this.someID = someId;
log.info(this.someID);
//use someID here
}
}
pulic class otherClass{
public otherMethod(string sym){
IDs id = new IDs(sym);
}
}
public class anotherClass{
//access instance of otherClass in wrp and call otherMethod()
wrp.otherMethod("someStringSymbol")
}
答案 0 :(得分:1)
当您必须从“视图” /“ Xml”中访问任何元素时。您可以做以下事情来访问它。
在 onCreateView 中:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_layout, parent, false); // This will take you're Fragment layout.
ListView listView = (ListView )rootView.findViewById(R.id./*Id of listview*/);
//Then you can access the things you want to do
listView.getBackground().setAlpha(200); //Something like this Here you're listview is assigned
return rootView;
}