Android 애플리케이션을 개발 중이며 HTML 페이지를 표시해야합니다. Android : XML에서 웹보기에 버튼 추가
나는<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</WebView>
<Button
android:id="@+id/disease_consultation_button"
android:layout_width="@dimen/buttonWidth"
android:layout_height="@dimen/buttonHeight"
android:layout_gravity="right"
android:layout_marginRight="20dp"
style="@style/buttonStyle"
android:text="@string/continue_button" />
</LinearLayout>
아래로 및 자바 코드
WebView webView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.disease_web_view_activity);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
String customHtml = "<html><body><h1>Hello, WebView</h1></body></html>";
webView.loadData(customHtml, "text/html", "UTF-8");
}
버튼이보기에 표시되지 않습니다에서 웹보기를 사용하여이 작업을 수행하기 위해 관리하고 그 이유를 몰라?
누구든지 나를 도와 줄 수 있습니까?
보기이
편집과 같다 : 이것은 내가 한 문제를 해결할 것입니다 =)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView android:id="@+id/disease_consultation_titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/activityTitle" />
<Button
android:id="@+id/disease_consultation_button"
android:layout_width="wrap_content"
android:layout_height="@dimen/buttonHeight"
android:layout_gravity="right"
android:layout_marginLeft="550dp"
android:layout_marginTop="80dp"
style="@style/buttonStyle"
android:text="@string/request_new_consultation" />
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="150dp" >
</WebView>
</RelativeLayout>
덕분에 ....대단히 감사합니다 =) –