2013-08-16 4 views
0

UI가 폭이 넓은 대시 선을 고정하는 방법은? 내 화면에서 대시 라인은 화면의 너비에 맞게 완전히 맞지 않습니다. 나는 수동으로 사용했다. 대시의 경우 모바일 너비가 작 으면 다음 줄로 이동한다. 모바일 너비가 두꺼운 경우 아래의 일부 대시가 약간의 공간 형태로 남아있다.화면 너비에 따라 파선을 조정하는 방법

My screenshot

내 코드는 우는 소리입니다 :

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/border5" > 

      <ImageView 
       android:id="@+id/test_button_image" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:paddingLeft="5dp" 
       android:src="@drawable/iicon" > 
      </ImageView> 

      <TextView 
       android:id="@+id/test_button_text2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignTop="@+id/test_button_image" 
       android:layout_toRightOf="@+id/test_button_image" 
       android:paddingLeft="10dp" 
       android:paddingTop="10dp" 
       android:text="Description" 
       android:textColor="#000000" 
       android:textSize="15sp" 
       android:textStyle="bold" > 
      </TextView> 

      <TextView 
       android:id="@+id/test_button_text23" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignLeft="@+id/test_button_text2" 
       android:layout_below="@+id/test_button_text2" 
       android:paddingBottom="10dp" 
       android:paddingLeft="10dp" 
       android:text="-------------------------------------------------" 
       android:textColor="#000000" > 
      </TextView> 

      <TextView 
       android:id="@+id/description" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignLeft="@+id/test_button_text2" 
       android:layout_below="@+id/test_button_text23" 
       android:paddingBottom="10dp" 
       android:paddingLeft="10dp" 
       android:text=" " 
       android:textColor="#000000" > 
      </TextView> 
     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/border5" > 

      <ImageView 
       android:id="@+id/test_button_image20" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:paddingLeft="5dp" 
       android:src="@drawable/iicon" > 
      </ImageView> 

      <TextView 
       android:id="@+id/test_button_text12" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignTop="@+id/test_button_image20" 
       android:layout_toRightOf="@+id/test_button_image20" 
       android:paddingLeft="10dp" 
       android:paddingTop="10dp" 
       android:text="Contains" 
       android:textColor="#000000" 
       android:textSize="15sp" 
       android:textStyle="bold" > 
      </TextView> 

      <TextView 
       android:id="@+id/test_button_text5" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/test_button_text12" 
       android:layout_toRightOf="@+id/test_button_image20" 
       android:paddingBottom="10dp" 
       android:paddingLeft="10dp" 
       android:text="---------------------------------------" 
       android:textColor="#000000" > 
      </TextView> 

      <com.schoollunchapp.HorizontalListView 
       android:id="@+id/listview2" 
       android:layout_width="wrap_content" 
       android:layout_height="150dp" 
       android:layout_below="@+id/test_button_text5" 
       android:background="#ffffff" /> 
     </RelativeLayout> 
+0

고정하는 방법 ---- 줄 너비의 전체 ​​??? 화면 너비와 자동 맞춤 – user2686011

+0

사용해보기 : http://stackoverflow.com/questions/2658772/android-vertical-line-xml –

+0

화면의 너비와 함께 대시 줄을 표시하려는 경우 noany 공간을 오른쪽에서 왼쪽으로 지정 – user2686011

답변

0

나는 그것의 완벽하게 귀하의 요구 사항과 확인 인출 선을 만들려고하지만.

드로어 블/사진 dotted.xml :

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="line"> 

    <stroke 
     android:color="#C7B299" 
     android:dashWidth="10px" 
     android:dashGap="10px" /> 
</shape> 

view.xml : 또한 this answer를 참조 더 이해를 돕기 위하여

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/dotted" /> 

. 희망이 도움이됩니다.

+0

도움이되지 않는 경우 : ( – user2686011

+0

부모보기가 fill_parent 여야합니다.이 코드를 사용하여 무엇을 얻고 있습니까? –

관련 문제