마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

시크바 배경 및 thumb에 대해 질문드립니다.

0 추천
<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="0dp"
   android:layout_weight="2.6"
   android:background="@drawable/sdm_list_bg_2"
   android:orientation="horizontal" >

   <LinearLayout
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="horizontal" />

   <LinearLayout
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="98"
      android:orientation="horizontal" >

      <SeekBar
         android:id="@+id/sbSdmDim1WC"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:thumb="@drawable/test_bar_pin50x50"
         android:background="@drawable/sdm_warmcool_reverse"
         android:progressDrawable="@android:color/transparent"
         android:max="100"
         android:progress="0"/>

   </LinearLayout>

   <LinearLayout
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="horizontal" />

</LinearLayout>

 

백그라운드로 이미지를 넣어줬는데요

스마트폰에서는 이미지가 제대로 출력이 되는데

태블릿에서 보니까 이미지 밖으로 thumb가 나오네요

5 ~ 95 사이일 때만 제대로 이미지 안에서 놀고 있고

0과 100에서는 동떨어져 있는데..

ㅇ |==========|         (ㅇ는 thumb입니다.)

이런 식으로 출력이 됩니다.

progressdrawable로 뒷 이미지를 하려고 했다가 이미지가 이상하게 출력이 되어서 background로 하였습니다.

이 부분 비슷한 경우 발생하신 분 있으신가요??

혹시 어떻게 처리를 하셨는지 궁금합니다ㅠㅠ

zenojm (2,840 포인트) 님이 2017년 9월 4일 질문

1개의 답변

0 추천
 
채택된 답변
저는 orientation이 horizontal  인 경우,

 그 안에 orientation이 vertical 인 match parent인 linearlayout을 넣고,

그 안에 다시 orientation이 horizontal인 linearlayout을 구성합니다.

weight를 사용할 경우 같은 orientation이 사용되면, 제대로 동작하지 않습니다. 번갈아 가면서 사용해야 합니다.

저는 그렇게 구성합니다.

그리고 맨 마지막 객체에는 orientation을 구성할 필요는 없습니다.
Will Kim (43,170 포인트) 님이 2017년 9월 4일 답변
zenojm님이 2017년 9월 6일 채택됨
...