2013-07-06 3 views
0

이미지보기 및 탐색 바를 가지고있어 이미지보기에 표시되는 이미지를로드 할 수 있으며 탐색 표시 줄은 이미지보기 바로 아래에 있어야합니다. .I는 main.xml에 다음 코드를이미지보기 아래에 Seekbar의 위치 설정

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" > 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="148dp" 
     android:src="@drawable/ic_launcher" /> 

    <SeekBar 
     android:id="@+id/seekBar1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/imageView1" 
     android:layout_marginTop="95dp" 


     /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_alignRight="@+id/imageView1" 
     android:layout_marginRight="30dp" 
     android:layout_marginTop="78dp" 
     android:text="TextView" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginBottom="31dp" 
     android:text="Button" 
     android:onClick="clickme" 

     /> 

</RelativeLayout> 

문제를 내가 SeekBar를 내가 이미지 크기를 조정해야한다고 생각 view.I 이미지에 포함 또는 일부 속성을 설정 다른 크기의 이미지를로드 할 때입니다 C#에서 'Strech'와 같은 이미지 뷰를 사용하여 적절한 레이아웃을 유지할 수 있습니다. 어떤 사람이 올바른 경로를 보여줄 수 있습니까?

답변

0

이미지 뷰의 이러한 속성으로 인해 이미지 뷰가 확대됩니다.

사용과 같은 android:adjustViewBounds

+0

시도 안드로이드 : adjustViewBounds 이제 이미지가 커버 슬라이더와 버튼 모두 – techno

0

변경 SeekBar를 상기와 이미지 뷰의 정렬, 뭔가 :

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="148dp" 
    android:layout_above="@+id/seekBar1" 
    android:src="@drawable/ic_launcher" /> 

<SeekBar 
    android:id="@+id/seekBar1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_above="@+id/textView1" 
    android:layout_marginTop="95dp" 
    /> 

항상 검색 막대 위에로 이미지보기를 강제로 이런 식으로.

0

간단한 솔루션 사용의 LinearLayout :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:paddingBottom="@dimen/activity_vertical_margin" 
       android:paddingLeft="@dimen/activity_horizontal_margin" 
       android:paddingRight="@dimen/activity_horizontal_margin" 
       android:paddingTop="@dimen/activity_vertical_margin" 
       android:orientation="vertical" 
       tools:context=".MainActivity"> 

    <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="18dp" 
      android:layout_gravity="center" 
      android:text="TextView"/> 

    <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="256dp" 
      android:layout_height="256dp" 
      android:layout_marginTop="20dp" 
      android:layout_gravity="center" 
      android:src="@drawable/ic_launcher"/> 

    <SeekBar 
      android:id="@+id/seekBar1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="15dp" 
      android:layout_gravity="center" 
      /> 

    <View 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1"/> 

    <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="31dp" 
      android:layout_gravity="center" 
      android:text="Button" 
      android:onClick="clickme" 
      /> 
</LinearLayout> 

참고 android:layout_gravity="center", 나는이 layout_weight를 가진 더미보기를 추가 한가 버튼 위의 공간을 채우도록; 그래서 버튼은 맨 아래에있게됩니다.

업데이트 : 업데이트 개별 마진

+0

이것은 작동하지 않습니다. 어떤 레이아웃입니까? – techno

+0

죄송합니다. LinearLayout이 나타나게하려면 첫 줄을 들여 줘야했습니다. –

+0

업데이트 된 버전 도움이 되었습니까? –

0

가장 쉬운 방법은 다음과 같습니다

<Seekbar android:layout_width="match_parent" android:layout_height="match_parent" 
         android:layout_below="@+id/YouImageViewID"/> 
0

나타나서 RelativeLayout의 시도, 여기에 일부 코드

<RelativeLayout 
android:layout_width="100dp" 
    android:layout_height="100dp" 
    android:gravity="center" 
> 
<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_centerInParent="true" 
    android:src="@drawable/androidbiancheng" 
    /> 
<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    android:src="@drawable/icon" 
    /> 
<ProgressBar 
    android:id="@+id/progressbar" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    /> 
</RelativeLayout>