在Android Studio 2.1.2中,如果我创建默认导航活动,我会得到以下视图:
其中使用以下activity_main.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
正如你所看到<android.support.design.widget.NavigationView/>的用途app:menu="@menu/activity_main_drawer",用于显示在菜单中定义的列表activity_main_drawer.xml文件,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/ic_menu_camera"
android:title="Import" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="Gallery" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="Slideshow" />
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:title="Tools" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="Send" …Run Code Online (Sandbox Code Playgroud) java android expandablelistview navigationview android-navigationview
我有一个 ListView 如下
<ListView
Grid.Row="0"
Margin="0"
x:Name="ItemsListView"
ItemsSource="{Binding SourceItems}"
VerticalOptions="FillAndExpand"
HasUnevenRows="false"
RefreshCommand="{Binding LoadItemsCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsBusy}"
ItemSelected="OnItemSelected"
IsVisible="{Binding ShowListView}"
RowHeight="55">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid
Margin="15,0,0,0"
Padding="0"
RowSpacing="0"
ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="1*" />
<ColumnDefinition
Width="7*" />
<ColumnDefinition
Width="1*" />
<ColumnDefinition
Width="1*" />
</Grid.ColumnDefinitions>
<Image
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HeightRequest="35"
WidthRequest="35"
Grid.Row="0"
Grid.Column="0"
Aspect="AspectFit"
Source="{Binding Icon}">
</Image>
<StackLayout
VerticalOptions="CenterAndExpand"
Spacing="0"
CompressedLayout.IsHeadless="true"
Margin="15,0,0,0"
Grid.Row="0"
Grid.Column="1">
<Label
VerticalTextAlignment="Start"
Text="{Binding Name}"
FontAttributes="Bold"
LineBreakMode="NoWrap"
Style="{DynamicResource ListItemTextStyle}"
FontSize="16" />
<Label
VerticalTextAlignment="Start"
Text="{Binding Description}"
LineBreakMode="NoWrap" …Run Code Online (Sandbox Code Playgroud) 我正在尝试分配不同的CornerRadius内容iOS,Android例如:
<Frame
HasShadow="false"
Padding="10"
BackgroundColor="Red">
<Frame.CornerRadius>
<OnPlatform x:TypeArguments="x:Double">
<On
Platform="iOS">20</On>
<On
Platform="Android">30</On>
</OnPlatform>
</Frame.CornerRadius>
<Label
Text="Hello World" />
</Frame>
Run Code Online (Sandbox Code Playgroud)
但是得到一个
无法分配属性“ CornerRadius”:属性不存在或不可分配,或者值和属性之间的类型不匹配
我试过x:TypeArguments="Thickness"和x:TypeArguments="x:Int32"。反汇编程序集似乎CornerRadius是类型float。但是,中没有Float属性x namespace,我的意思x:TypeArguments="x:Float"是不存在。
有任何想法我做错了还是这是一个错误?
我有一个包含四个表的数据库。图中的关系架构如下:

以下是这些行:

现在,我正在尝试删除具有所有者ID的所有者OW1。由于id是所有者表中的主键,而其他表中的外键则不允许我删除该行。这是我尝试的SQL:
delete from owners
where ownerid = 'OW1' and petid = 'PT1'
Run Code Online (Sandbox Code Playgroud)
它返回:
ORA-02292: integrity constraint (TEST_1.ADDRESSES_OWNERS_FK) violated - child record found
而且我不允许在关系图中将删除规则设置为“ CASCADE”。请帮忙 :(
所以我触发如下
create or replace TRIGGER TWELVE_ONE
BEFORE INSERT OR UPDATE OR DELETE
ON ORDERS
FOR EACH ROW
DECLARE
V_DAY VARCHAR2 (10);
MyException exception;
BEGIN
SELECT TO_CHAR (SYSDATE, 'DAY') INTO V_DAY FROM DUAL;
DBMS_OUTPUT.PUT_LINE(V_DAY);
IF (V_DAY='SUNDAY')
THEN
raise_application_error(-20001, 'Today is Sunday. Order table cannot be altered');
end if;
END;
Run Code Online (Sandbox Code Playgroud)
这应该防止UPDATE,INSERT并且DELETE如果系统一天SUNDAY.从逻辑上讲,它似乎是正确的,但不幸的是它仍然允许插入.我在这做错了什么?我正在使用SQL Developer请帮助非常感谢
可以说我有一张桌子如下-
create table employees
(
eno number(4) not null primary key,
ename varchar2(30),
zip number(5) references zipcodes,
hdate date
);
Run Code Online (Sandbox Code Playgroud)
我使用以下代码块创建了一个触发器
create or replace TRIGGER COPY_LAST_ONO
AFTER INSERT ON ORDERS
FOR EACH ROW
DECLARE
ID_FROM_ORDER_TABLE VARCHAR2(10);
BEGIN
SELECT MAX(ORDERS.ONO)INTO ID_FROM_ORDER_TABLE from ORDERS ;
DBMS_OUTPUT.PUT_LINE(ID_FROM_ORDER_TABLE);
INSERT INTO BACKUP_ONO VALUES( VALUE1, VALUE2,VALUE3, ID_FROM_ORDER_TABLE);
END;
Run Code Online (Sandbox Code Playgroud)
触发器在插入后触发,并尝试从触发它的表中读取(逻辑上是duhh!),但是oracle给我一个错误,并要求我修改触发器,以便它不读取表。错误代码-
Error report -
SQL Error: ORA-04091: table TEST1.ORDERS is mutating, trigger/function may not see it
ORA-06512: at "TEST1.COPY_LAST_ONO", line 8
ORA-04088: error during execution of trigger 'TEST1.LOG_INSERT' …Run Code Online (Sandbox Code Playgroud) 所有记录的更新声明是WHERE USID = 49什么?
这就是我目前拥有的:
INSERT INTO ADDRESSES (AddressLine1, AddressLine2, PostCode)
VALUES ('1A','2B', '3C') WHERE USID = 49;
Run Code Online (Sandbox Code Playgroud)
但我收到错误"关键字附近的语法不正确WHERE".我在这做错了什么?
我正在尝试创建一个简单的服务,其中派生类可以通过传入其自己的对象来重写虚拟方法。似乎无法正确理解语法。请参阅下面的代码:
所以基类如下:
public class FooBase
{
public virtual Task StartFooAsync<TParam>(TParam param) where TParam : IFooParam
{
Console.WriteLine(param.GetType());
return Task.CompletedTask;
}
}
Run Code Online (Sandbox Code Playgroud)
和IFooParam界面:
public interface IFooParam
{
public string Title { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
实现这个简单接口的类是:
public class FooParam : IFooParam
{
public string Title { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试继承 FooBase 类时:
public class FooOne : FooBase
{
public override Task StartFooAsync(FooParam param) // wont compile :(
{
return base.StartFooAsync(param);
}
}
Run Code Online (Sandbox Code Playgroud)
我收到编译时错误,告诉我没有合适的方法可以覆盖StartFooAsync
这里的目标是从类继承FooBase 并提供自己的实现,并以其首选类型作为参数StartFooAsync