我收到这个错误:
getDeviceId: Neither user 10111 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
Run Code Online (Sandbox Code Playgroud)
我虽然已经明白了.Android 6.XX Marshmallow设备有什么变化吗?我需要READ_PHONE_STATE允许获取设备的IMEI.PLS.救命.
嘿伙计我一直在用动态列表实现numpicker,即在某些事件上有所改变,比如它可能是一个按钮点击或者其他.问题是每当我将列表从较长的长度切换到较小的长度时它起作用,较小的长度到较大的长度它不会改变,而我总是将第一个项目设置为所选项目.它崩溃了.PLS.帮助.我是Android的新手.
码:
public class MainActivity extends Activity {
NumberPicker numPicker = null;
String values1[] = null;
String values2[] = null;
String values3[] = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
values1 =new String []{
"Yello",
"Red",
"White",
"Green",
"Black"
};
values2 =new String []{
"Mango",
"Orange"
};
values3 =new String []{
"Class",
"Pointer",
"Function",
"Interafce",
"Constructor"
};
numPicker = (NumberPicker)findViewById(R.id.numberPicker1);
numPicker.setDisplayedValues(values1);
if(values1.length>1)
{
numPicker.setMaxValue(values1.length-1);
}
else
{
numPicker.setMaxValue(values1.length);
}
numPicker.setMinValue(0);
numPicker.setValue(0);
numPicker.setBackgroundColor(1);
numPicker.setWrapSelectorWheel(false);
numPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
//On value change listner …Run Code Online (Sandbox Code Playgroud) 我在水平滚动视图中实现了一个表格布局,它也是垂直滚动视图的子级。它是这样工作的;当垂直或水平滚动时,它为每种滚动类型明确滚动。意味着垂直滚动时水平滚动根本不会发生,比如说如果手指对角移动,则不会发生垂直或水平滚动。要水平滚动它,必须再次触摸它并且它仅在水平方向滚动,如果手指对角移动,则不会发生垂直或水平滚动。[此处相同]。
似乎在一个手指触摸实例中只处理一个回调。我也需要对角滚动,应该同时垂直和水平滚动,就像在 iOS 表视图中一样。向所有 6 个方向滚动。
这是代码;
<?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">
<ScrollView
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dip"
android:scrollbars="none">
<HorizontalScrollView
android:id="@+id/horizontalView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:scrollbars="horizontal|vertical">
<TableLayout
android:id="@+id/tlGridTable"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:id="@+id/row1"
android:layout_width="wrap_content"
android:layout_height="50dp">
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_margin="4dp"
android:background="@android:color/holo_green_light"/>
</TableRow>
<TableRow
android:id="@+id/row1" …Run Code Online (Sandbox Code Playgroud) 我想设置默认情况下左侧显示的指示器图标,应该显示在右侧.我曾尝试过在谷歌上找到的所有技术,但似乎我的expandablelistview有些问题或者有其他方法可以做到这一点,我试过:explistobj.setInicatorBounds(...)不起作用:(添加属性in xml android:indicatorLeft ="250dp"android:indicatorRight ="300dp"不起作用:(
码:
public class MainActivity extends Activity {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get the listview
expListView = (ExpandableListView) findViewById(R.id.lvExp);
// preparing list data
prepareListData();
setDimens();
listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
// Listview Group click listener
expListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// Toast.makeText(getApplicationContext(),
// "Group Clicked " …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现眨眼动画。
此代码使视图闪烁淡入和淡出:
AlphaAnimation blink = new AlphaAnimation(0.0f, 1.0f);
blink.setDuration(500);
blink.setStartOffset(0);
//changing it makes more than one animation appear in different time stamps.
blink.setRepeatMode(Animation.REVERSE);
blink.setRepeatCount(Animation.INFINITE);
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
android ×5