嗨,我想让我的线性布局像按钮一样工作.我的意思是当状态改变时我试图改变它的背景颜色.我使用了选择器来解决它,但它没有用.
我寻找解决方案,他们说的只是添加可点击属性.我已经做到了.
我的LinearLayout包含两个LinearLayout,每个包含9个TextView.它们完全填满了我的LinearLayout.
我想到的是它的孩子正在吸收点击事件,而我的LinearLayout并没有将其状态改为按下状态.
所以我在我的LinearLayout的每个子节点上都将clickable和focusalbe属性设置为false.
但是,它仍然是一样的.
这是我的代码.
这是选择器jbbtn.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:state_pressed="true"
android:drawable="@drawable/jbbtn_pressed"/>
<item android:state_enabled="true"
android:drawable="@drawable/jbstyle_transparent"/>
<item android:state_enabled="false" android:drawable="@drawable/jbbtn_disabled"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
这是我的LinearLayout
<LinearLayout
android:id="@+id/llCurrents"
android:background="@drawable/jbbtn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/llTimer"
android:layout_below="@id/btnMenu"
android:layout_marginRight="3sp"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="3sp" >
~~~~~~
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我刚开始用DirectX11的3D游戏编程学习直接3D .
我按照第一个教程得到了一个MessageBox,说"D3D11CreateDevice失败".
我检查了这个函数的返回值并获得了垃圾值-2005270483.十六进制值0x887a002d,人们说这是DXGI_ERROR_SDK_COMPONENT_MISSING错误的.
但是,我找不到任何有关它的信息.此外,它没有D3D11CreateDevice()MSDN通知的可能值.
以下是创建D3D设备的书的代码:
bool D3DApp::InitDirect3D()
{
// Create the device and device context.
UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_FEATURE_LEVEL featureLevel;
HRESULT hr = D3D11CreateDevice(
0, // default adapter
md3dDriverType,
0, // no software device
createDeviceFlags, // createDeviceFlags,
0, 0, // default feature level array
D3D11_SDK_VERSION,
&md3dDevice,
&featureLevel,
&md3dImmediateContext);
if( FAILED(hr) )
{
// I added this part to check out …Run Code Online (Sandbox Code Playgroud)