2015-08-05 4 views
-1

Мне нужно иметь представление изображения над моими вкладками. Но ImageView не является устройством вообще. В устройстве верхние - это вкладки без представления изображения. Ниже мой макет xml. Пожалуйста помоги.Image View Не отображается над вкладками Android

<?xml version="1.0" encoding="utf-8"?> 

<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    > 
<LinearLayout 

    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <ImageView 
     android:layout_width="fill_parent" 
     android:layout_height="100dp" 
     android:id="@+id/imageView2" 
     android:background="@color/list_view_blue" 
    /> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/imageView2" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:layout_marginTop="100dp" /> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"/> 
    </LinearLayout> 
</TabHost> 

ответ

0

Я думаю, что проблема в урском обычном фоне, если у вас нет фона? или у вас есть, чтобы изменить в вашей onCreateView, как показано ниже:

public View onCreateView(LayoutInflater inflater, ViewGroup container, 

    Bundle savedInstanceState) { 
    rootView = inflater.inflate(R.layout.tab2m, container, false); 

    ImageView img1 = (ImageView)rootView.findViewById(R.id.imageView2); 

    } 
+0

До сих пор не работает – Abhi1988

1

Добавление

setContentView(R.layout.activity_payment) 

исправили проблему.

0

Использование Relative Layout вместо линейной компоновки

+0

Привет Sundeep, добавив setContentView (R.layout.activity_payment) исправили проблему – Abhi1988

Смежные вопросы