我很难创建一个简单的应用程序,顶部菜单和下面的可更改视图(通过按菜单片段中的按钮我们更改下面片段的视图).所以,我在主视图中有2个片段,但是当我试图在模拟器中运行应用程序时,我得到一个错误:
Cause by android.app (bla bla bla, piece of crap Eclipse doesn't even allow copying the errors):
Trying to instantiate a class com.example.android.topmenu that is not a fragment
Run Code Online (Sandbox Code Playgroud)
所以,这些是我的XML布局:
main.xml中
<?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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/menuFragment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:name="com.example.android.topmenu" >
</fragment>
<fragment
android:id="@+id/contentFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.example.android.bottomcontent" >
</fragment>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
topmenu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/Button1"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
bottom_content.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp" …Run Code Online (Sandbox Code Playgroud) <img>我在弹性父级内部变得灵活时遇到问题。图像开始超过父尺寸。我想留给父母并display: flex;限制图像跨越父母的尺寸。
.full
{
width: 400px;
height: 200px;
background-color: blue;
display: flex;
flex-direction: row;
justify-content: flex-start;
}
.half
{
width: 50%;
background-color: red;
padding: 20px;
}
img
{
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}Run Code Online (Sandbox Code Playgroud)
<div class="full">
<div class="half">
<h1>title</h1>
<img src="http://placehold.it/90x200">
</div>
</div>Run Code Online (Sandbox Code Playgroud)
您能否解释并提供一些有用的链接来解释所显示的行为及其可能的解决方案?
我使用 Firefox 和 Chrome 来查看该内容。两个浏览器中均存在问题。
看来这个问题是这个问题的重复
Bootloader分为两个阶段.第一阶段用汇编语言编写,只加载第二阶段,第二阶段在C阶段.阶段1加载C中的代码到地址0x0500:0,并跳转到那里.Stage2必须写"hello message"并停止.
我尝试了不同的方法将起始地址设置为原始二进制文件:(但没有任何效果)
cc -nostartfiles -nostdlib -c stage2.c
ld -s -T scrptfile.ld stage2.o /* I'm using ld just to set starting address of executable */
objcopy -O binary stage2 stage2.bin /* delete all unuseful data */
Run Code Online (Sandbox Code Playgroud)
链接器脚本
SECTIONS
{
. = 0x0500;
.text : { *(.text)}
.data : { *(.data)}
.bss : { *(.bss)}
}
Run Code Online (Sandbox Code Playgroud)
也许我删除objcopy somethnig应删除.
那我怎么能执行这个stage2.bin呢?
据我所知,使用32位长度指令编写C代码,当原始二进制只允许16?
PS参数-set-start(objcopy)返回错误:无效的bfd目标.这是因为输出文件是二进制的?
谢谢你的回答.