2017-03-23 8 views
0

私はリストビューのプロジェクトを持っています。リストメニューの1つを入力するとアクティビティが開き、アクティビティのレイアウトがScrollViewで塗りつぶされ、アクションバーも表示されますが、ウィジェットツールバーを配置すると、このようになります。ScrollViewでアクションツールバーを設定する方法は?

enter image description here

何も表示されませんでした。

これは、スクロールbview

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:background="#ff00606d" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto"> 
    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 

     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/colorPrimary" 
     android:id="@+id/toolbar2" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:titleTextAppearance="@style/Toolbar.TitleText" 
     app:title="Light" 
     app:titleTextColor="#ffffff"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <ImageButton 
       android:id="@+id/btn_back" 
       android:layout_width="50px" 
       android:layout_height="50px" 
       android:layout_alignParentLeft="true" 
       android:background="@android:color/transparent" 
       android:src="@mipmap/ic_previous" /> 

      <TextView 
       android:id="@+id/txt_title" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_marginLeft="16dp" 
       android:layout_marginStart="16dp" 
       android:layout_toEndOf="@+id/btn_back" 
       android:layout_toRightOf="@+id/btn_back" 
       android:text="Title" 
       android:textColor="@android:color/white" 
       android:textSize="16sp" 
       android:textStyle="bold" /> 

     </RelativeLayout> 
    </android.support.v7.widget.Toolbar> 
    <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content"> 
     <LinearLayout android:orientation="vertical" android:padding="5.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="30.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="1-Incandescent " /> 
       <ImageView android:background="@drawable/lamp1" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="An incandescent light bulb, incandescent lamp or incandescent light globe is an electric light which produces light with a wire filament heated to a high temperature by an electric current passing through it, until it glows (see Incandescence). The hot filament is protected from oxidation with a glass or quartz bulb that is filled with inert gas or evacuated. In a halogen lamp, filament evaporation is prevented by a chemical process that redeposits metal vapor onto the filament, extending its life. The light bulb is supplied with electric current by feed-through terminals or wires embedded in the glass. Most bulbs are used in a socket which provides mechanical support and electrical connections. " /> 
      </LinearLayout> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="30.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="2-Tungsten Halogen " /> 
       <ImageView android:background="@drawable/lamp2" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="A halogen lamp, also known as a tungsten halogen, quartz-halogen or quartz iodine lamp, is an incandescent lamp that has a small amount of a halogen such as iodine or bromine added. The combination of the halogen gas and the tungsten filament produces a halogen cycle chemical reaction which redeposits evaporated tungsten back onto the filament, increasing its life and maintaining the clarity of the envelope. Because of this, a halogen lamp can be operated at a higher temperature than a standard gas-filled lamp of similar power and operating life, producing light of a higher luminous efficacy and color temperature. The small size of halogen lamps permits their use in compact optical systems for projectors and illumination." /> 
      </LinearLayout> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="3-Low Pressure Mercury" /> 
       <ImageView android:background="@drawable/lamp3" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="A low-pressure mercury lamp (LP Hg lamp) is a highly efficient UV light source of short wavelength.Classified as in the same group as fluorescent lamps or germicidal lamps, the main light emission is a 254nm line comprising an 185nm line of far shorter wavelength. Quite unlike LP mercury lamps, the high-pressure mercury lamps (HP Hg lamp) irradiate lights of many wavelengths including a visible light." /> 
      </LinearLayout> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="4-High Pressure Mercury " /> 
       <ImageView android:background="@drawable/lamp4" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="High-pressure discharge lamps generate a very large quantity of light in a very small space due to arc discharge. Exterior illumination for all kinds of traffic installations, stadiums, construction sites and buildings almost only use this type of lamp, and they are also often used for indoor lighting in industrial and sports complexes, sales rooms, foyers and trade fair booths. These lamps cover a wide range of applications depending on the type of burner used inside the lamp – sodium vapour, mercury vapour, or halogen metal vapour – from economical street lighting right down to design illumination. Their high light yield means that they are the most economical artificial light sources you will find anywhere. " />/> </LinearLayout> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="5-Metal halide " /> 
       <ImageView android:background="@drawable/lamp5" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="A metal-halide lamp is an electric lamp that produces light by an electric arc through a gaseous mixture of vaporized mercury and metal halides[1][2] (compounds of metals with bromine or iodine). It is a type of high-intensity discharge (HID) gas discharge lamp.[1] Developed in the 1960s, they are similar to mercury vapor lamps,[1] but contain additional metal halide compounds in the quartz arc tube, which improve the efficiency and color rendition of the light. The most common metal halide compound used is sodium iodide. Once the arc tube reaches its running temperature, the sodium dissociates from the iodine, adding orange and reds to the lamp's spectrum from the sodium D line as the metal ionizes. As a result, metal-halide lamps have high luminous efficiency of around 75 - 100 lumens per watt,[2] which is about twice that of mercury vapor lights and 3 to 5 times that of incandescent lights[1] and produce an intense white light. Lamp life is 6,000 to 15,000 hours.[2][3] As one of the most efficient sources of high CRI white light, metal halides as of 2005 were the fastest growing segment of the lighting industry.[1] They are used for wide area overhead lighting[2] of commercial, industrial, and public spaces, such as parking lots, sports arenas, factories, and retail stores,[1] as well as residential security lighting and automotive headlamps (xenon headlights). " /> 
      </LinearLayout> 
      <LinearLayout android:orientation="vertical" android:background="@drawable/round_corners_blue" android:padding="10.0dip" android:paddingTop="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20.0dip"> 
       <TextView android:textSize="20.0sp" android:textColor="#ff000000" android:gravity="center" android:background="@drawable/round_corners_bluesky" android:clickable="false" android:layout_width="fill_parent" android:layout_height="45.0dip" android:text="6-High pressure sodium " /> 
       <ImageView android:background="@drawable/lamp6" android:clickable="false" android:layout_width="fill_parent" android:layout_height="240.0dip" android:layout_marginTop="5.0dip" android:scaleType="fitXY" /> 
       <TextView android:textSize="12.0sp" android:textColor="#ff000000" android:background="@drawable/round_corners_white" android:padding="10.0dip" android:clickable="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip" android:layout_marginBottom="10.0dip" android:text="A sodium-vapor lamp is a gas-discharge lamp that uses sodium in an excited state to produce light. There are two varieties of such lamps: low pressure and high pressure. Low-pressure sodium lamps are highly efficient electrical light sources, but their yellow light restricts applications to outdoor lighting such as street lamps.[1] High-pressure sodium lamps have a broader spectrum of light than the low-pressure lamps, but still poorer color rendering than other types of lamps.[2] Low-pressure sodium lamps only give monochromatic yellow light and so inhibit color vision at night. " /> 
      </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

と活動のための私のレイアウトが私のレイアウトに何か問題がありますか?

答えて

0

あなたのメインLinearlayoutで方向を設定してください。親でLinearlayoutを使用しているため、デフォルトの向きが水平なので設定する必要があります。

android:orientation="vertical" 
+0

ありがとうございます。D –

関連する問題