내 웹보기가 아무 문제없이 잘 표시됩니다. 그러나 "선택한 텍스트"기능을 적용하면 웹보기가 화면 절반에만 표시됩니다 (아래 이미지 참조). 내가 잘못 한 일을 아무 생각Android WebView가 절반 화면에만 표시됩니다.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.content);
Intent i = this.getIntent();
final int wordId = i.getIntExtra("id", -1);
mCurrentWord = i.getStringExtra("word");
mSelectedDB = i.getStringExtra("db");
mContentStyle = i.getStringExtra("style");
prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
loadHistoryFromPreferences();
loadFavouriteFromPreferences();
wvContent = (WebView) findViewById(R.id.wvContent);
initWebview();
String content = getContentById(wordId);
showContent(content);
//This is the beginning of what I added
webkit=new Webkit(this);
wvContent.addView(webkit);
WebkitSelectedText webkitSelectedText=new WebkitSelectedText(getApplicationContext(), webkit);
webkitSelectedText.init();
wvContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//This is the end of what I added
:
여기 내 코드입니다. 이 디스플레이 문제를 제외하고 새로 추가 된 것을 포함하여 다른 모든 기능은 Selected text
잘 작동합니다.
여러분이 문제를 인식하고 해결할 수 있기를 바랍니다. 고맙습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="bottom|fill_vertical"
>
<LinearLayout xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_weight="1"
>
<WebView
android:id="@+id/wvContent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/btnHome"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/home"
android:layout_weight="0.25"
/>
<ImageButton
android:id="@+id/btnPronounce"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/pronounce"
android:layout_weight="0.25"
/>
<ImageButton
android:id="@+id/btnShowHistory"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/history"
android:layout_weight="0.25"
/>
<ImageButton
android:id="@+id/btnAddFavourite"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/add_favourite"
android:layout_weight="0.25"
/>
</LinearLayout>
감사합니다. 이미 "fill_parent"로 설정했습니다. 하지만 EDITED에서 내 레이아웃을 살펴 보시기 바랍니다. –
content.xml의 코드를 붙여주세요. – nithinreddy
그럼 누구나 문제를 파악할 수 있습니까? 도움을 받으십시오. –