i'm trying to create a ListView with a Webview inside, but the app shows nothing.
Here my Code:
The MainActivity where I set the CustomAdapter
public class Web_in_list1Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView lv = (ListView)findViewById(R.id.listView2);
ListViewAdapter adapter = new ListViewAdapter(this);
lv.setAdapter(adapter);
}
}
getView of the CustomAdapter
Here I get the Layout for the ListView and ste the URL for the Webview
public View getView(int arg0, View convertView, ViewGroup arg2) {
// TODO Auto-generated method stub
LayoutInflater inflater = context.getLayoutInflater();
convertView = inflater.inflate(R.layout.listitem, null);
WebView wv = (WebView)convertView.findViewById(R.id.webview);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl("http://www.google.com");
convertView.setTag(wv);
return convertView;
}
main.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:id="@+id/listView2"
android:layout_width="fill_parent"/>
listitem.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
CLOSED!
PROBLEM SOLVED WITH A SCROLLVIEW