2014-03-25 9 views
0

내 의도는 ImageView가 화면 중앙에있는 스크롤 뷰에서 위젯 목록을 만드는 것입니다. 예상대로ImageView를 표시 할 수 없습니다.

일식의 XML 그래픽 레이아웃 인터프리터에
<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:contentDescription="@string/description" 
    android:src="@drawable/myImage" 
    android:id="@+id/imageView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    android:scaleType="centerInside" /> 


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true"   
    android:background="@android:color/transparent"> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center"   
     android:orientation="vertical" 
     android:background="@android:color/transparent"> 


     <Button xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/newButton" 
      style="@style/homeScreenButton" 
      android:text="@string/new_profile" /> 

     <Button xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/loadButton" 
      style="@style/homeScreenButton" 
      android:text="@string/load_profile" /> 

     <Button xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/calculatorButton" 
      style="@style/homeScreenButton" 
      android:text="@string/calculator" /> 

    </LinearLayout> 

</ScrollView> 

</RelativeLayout> 

이 화면이 표시됩니다 : 여기에 모두가 말하고 완료되면 더 많은 버튼이있을 것, 내가 가진 것입니다. 동일한 두 가지 에뮬레이터, Android 2.2 및 Android 4.0.3에서도 마찬가지입니다. 그러나 내 실제 장치로 보낼 때 Droid 4 w/Android 4.1.2 이미지는 단순히을 표시하지 않습니다. 나는 심지어 ScrollView를 투명하게 만들려고 시도했다. (android : alpha = "0") 이미지를 어떻게 든 덮고 있다고 생각했다. 어떤 제안이라도 대단히 감사하겠습니다.

답변

0

xmlns:android="http://schemas.android.com/apk/res/android" 

그렇게 XML 파일 내가 그것을 알아 냈

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<ImageView 
android:contentDescription="@string/description" 
android:src="@drawable/myImage" 
android:id="@+id/imageView" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_centerInParent="true" 
android:scaleType="centerInside" /> 


<ScrollView 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_centerVertical="true"   
android:background="@android:color/transparent"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center"   
    android:orientation="vertical" 
    android:background="@android:color/transparent"> 


    <Button 
     android:id="@+id/newButton" 
     style="@style/homeScreenButton" 
     android:text="@string/new_profile" /> 

    <Button 
     android:id="@+id/loadButton" 
     style="@style/homeScreenButton" 
     android:text="@string/load_profile" /> 

    <Button 
     android:id="@+id/calculatorButton" 
     style="@style/homeScreenButton" 
     android:text="@string/calculator" /> 

</LinearLayout> 

</ScrollView> 

</RelativeLayout> 
+0

아니요, 해당 행을 삭제해도 아무 것도 변경되지 않았습니다. 어쨌든 제안 해 주셔서 감사합니다. – MrDetail

0

될 경우에만 RelativeLayout의

에 존재해야, 이미지 뷰에서이 줄을 제거하려고 , 코드 괜찮 았어. 내 문제는 이미지가/res/drawable에 있었지만/res/drawable-hdpi에 있어야한다는 것이 었습니다.

관련 문제