Android의 ScrollView에서 스크롤 막대 트랙 제거 내 레이아웃 XML의 ScrollView에 WebView를 래핑했지만

내 Android 앱에는 화면의 전체 너비를 사용하고 (수직으로) 스크롤 가능하게 만들 수있는 기본 WebView (로컬 리소스에서로드 된 HTML)가 있습니다. 그래서 내 레이아웃 XML의 ScrollView에 WebView를 래핑했지만 내가 무엇을하든 스크롤 뷰의 오른쪽에서 스크롤 막대 트랙을 제거 할 수없는 것 같습니다. 더 나쁜 것은 스크롤바 트랙의 배경색을 변경할 수 없다는 것입니다.

트랙은 약 10dp를 차지하므로 WebView에서 HTML에 문제가 발생합니다. 스크롤바 가 웹보기 상단 에 나타나기 원합니다 (내 말이 무슨 뜻인지 아시면 iPhone 스타일). 이제 내 대체 솔루션 인 “HTML을 10px 더 얇게 변경하지 않겠습니까?”라고 말할 수 있지만, 그럴 필요는 없습니다.

다음은 레이아웃 XML의 관련 스 니펫입니다. 내가 찾을 수있는 모든 android : etc 속성을 시도했음을 알 수 있습니다.

<ScrollView 
  android:id="@+id/deal_web_view_holder"
  android:layout_below="@id/clock_bar_holder"
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"
  android:fillViewport="false"
  android:fadingEdge="none"
  android:background="#02a7e9"
  android:scrollbars="none"
  android:scrollbarSize="0dp"
  android:paddingRight="0dp"
  android:scrollbarAlwaysDrawVerticalTrack="false"
  android:scrollbarStyle="insideOverlay"
  android:scrollbarTrackVertical="@drawable/scrollbar_track_vertical" >
    <WebView
       android:id="@+id/deal_web_view"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"/>  
</ScrollView>

나는 플랫폼 2.1 / API lvl 7을 목표로 삼고 있습니다. 정말 크기의 디스플레이, mdp, hdp 및 xhdp를 처리합니다.



답변

xml을 통해보기 (및 해당 하위 클래스)에서 스크롤 막대를 제거하려면 :

android:scrollbars="none"

http://developer.android.com/reference/android/view/View.html#attr_android:scrollbars


답변

이것이 당신의 활동입니다.

ScrollView sView = (ScrollView)findViewById(R.id.deal_web_view_holder);
// Hide the Scollbar
sView.setVerticalScrollBarEnabled(false);
sView.setHorizontalScrollBarEnabled(false);

http://developer.android.com/reference/android/view/View.html#setVerticalScrollBarEnabled%28boolean%29


답변

좀 당신이 퍼팅 왜 혼란 스러워요 WebView으로 ScrollView처음에. A WebView에는 자체 내장 스크롤 시스템이 있습니다.

실제 질문과 관련하여 Scrollbar상단에 표시하려면

view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY) or   
android:scrollbarStyle="insideOverlay"


답변

이것을 내에 추가하여 내 문제를 해결했습니다 ListView.

android:scrollbars="none"


답변

이러한 솔루션은 상대 레이아웃 내 경우에 실패하고 만약 키보드가 열려
android:scrollbars="none"
android:scrollbarStyle="insideOverlay"도 작동하지 않습니다.

툴바가 사라지고 완료 버튼이 사라졌습니다.

작동하지 않는

이것은 나를 위해 일하고 있습니다

myScrollView.setVerticalScrollBarEnabled(false);


답변

아래를 사용하여 문제를 해결했습니다.

android:scrollbarThumbVertical="@null"


답변