2016-07-17 8 views
0

私のカスタムタイトルバーの高さを増やそうとすると、その下のRelativeLayoutによってオーバーラップしています。ビューでオーバーレイされるカスタムヘッダータイトル

ヘッダーの高さを上げようとしましたが、重なっています。 また、正常に動作しなかったrelativeLayoutの高さを下げようとしました

下記の私のカスタムタイトルと関連レイアウトを見てください。

Windows_title

<?xml version="1.0" encoding="utf-8"?> 
 
<LinearLayout 
 
    xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:orientation="horizontal" 
 
    android:layout_width="fill_parent" 
 
    android:layout_height="40dip" 
 
    android:gravity="center_vertical" 
 
    android:paddingLeft="5dip" 
 
    android:background="#4A148C" 
 
    android:weightSum="1"> 
 

 
    <ImageView 
 
     android:id="@+id/header" 
 
     android:src="@drawable/header" 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:layout_marginLeft="-5dp" 
 
     android:paddingLeft="-10dp" /> 
 

 
    <TextView 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:textAppearance="?android:attr/textAppearanceMedium" 
 
     android:text="Medium Text" 
 
     android:id="@+id/title" /> 
 

 
</LinearLayout>

Activity_Main

<?xml version="1.0" encoding="utf-8"?> 
 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    xmlns:tools="http://schemas.android.com/tools" 
 
    android:layout_width="wrap_content" 
 
    android:layout_height="wrap_content" 
 
    tools:context="com.jiq.sagar.javainterviewquestion.MainActivity"> 
 
    <!--<include layout="@layout/windows_title" 
 
     android:id="@+id/include" />--> 
 

 
    <ListView 
 
     android:layout_width="wrap_content" 
 
     android:id="@+id/listView" 
 
     android:layout_alignParentLeft="true" 
 
     android:layout_alignParentStart="false" 
 
     android:background="#00BCD4" 
 
     android:clickable="false" 
 
     android:divider="#9f9b9b" 
 
     android:dividerHeight="2dp" 
 
     android:drawSelectorOnTop="false" 
 
     android:fastScrollAlwaysVisible="false" 
 
     android:fastScrollEnabled="false" 
 
     android:focusableInTouchMode="true" 
 
     android:longClickable="false" 
 
     android:nestedScrollingEnabled="false" 
 
     android:choiceMode="singleChoice" 
 
     android:layout_height="wrap_content" 
 
     android:paddingRight="5dp" 
 
     android:smoothScrollbar="true" /> 
 

 
</RelativeLayout>

私は、コードの下に使用してヘッダーを設定しています:

protected void onCreate(Bundle savedInstanceState) { 
    //Log.i(MY_TAG, "mainact"); 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
    setContentView(R.layout.activity_main); 
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.windows_title); 
    setTitle("Interview Question"); 
    dh = new DatabaseHelper(this); 
    getDatabase(); 
    mainlist(); 
} 

screenshot

+0

あなたが本当にあなたはスクリーンショットを意味 –

+0

何をしたいの画面たわごとをしてください追加しますか? ;):P – Manjuboyz

答えて

0
You can fix this issue in two ways, first uncomment your include layout and choose one of the below answer... 

1. use this line in your `ListView` component in `activity_main.xml` :-- 
     `android:layout_below="@+id/include"` 

2. change your `activity_main` to `linearLayout` and put orientation to vertical, you can see in code below  


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

     <include 
      android:id="@+id/include" 
      layout="@layout/window_title" /> 

     <ListView 
      android:id="@+id/listView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="false" 
      android:background="#00BCD4" 
      android:choiceMode="singleChoice" 
      android:clickable="false" 
      android:divider="#9f9b9b" 
      android:dividerHeight="2dp" 
      android:drawSelectorOnTop="false" 
      android:fastScrollAlwaysVisible="false" 
      android:fastScrollEnabled="false" 
      android:focusableInTouchMode="true" 
      android:longClickable="false" 
      android:nestedScrollingEnabled="false" 
      android:paddingRight="5dp" 
      android:smoothScrollbar="true" /> 

    </LinearLayout> 
+0

ありがとうRaviもし私がこれを行うと、私は2つのヘッダーを取得しています 参照用のスクリーンショットを追加しました。 –

+0

お返事ありがとうございました –

+0

テーマからデフォルトのアクションバーを変更していないと思います。あなたのres>スタイル –