我使用Android android.app.Dialog用于创建自定义对话框(用于按钮和背景)在我的对话我有TextView 一个内部的ScrollView,而我有一个简短的文字这个节目perfecly我怎么想,但如果文字是非常大的我对话采取全屏和我想要在对话框和屏幕边缘之间有一个最小边距.
我的问题是我希望Dialog不要大于需要而且我不能在此设置修复大小?
Here is how this look today.....I what a margin like this

该 GameDialog.java
public class GameDialog extends Dialog {
public GameDialog(Context ct, int titleID, int messageID) {
super(ct, R.style.dialog_style);
this.setContentView(R.layout.dialog_layout);
}
// This exist more code but this has noting with the layout to do,only set the text and show the button that exist since the XML file.
}
Run Code Online (Sandbox Code Playgroud)
该 R.style.dialog_style
<style name="dialog_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">?button_image</item>
<item name="android:windowNoTitle">true</item>
<item name="android:textColor">#FF000000</item>
<item name="android:textSize">20sp</item> …Run Code Online (Sandbox Code Playgroud) 我正在为Android开发一个应用程序,一个小的记事本应用程序.在我的应用程序中,我使用Gridview创建一个2*X大小的网格,并在每个单元格中我有一个LinearLayout调用AbstractNote,其任务是显示应用程序中每个保存注释的预览.
我的AbstractNote有一个背景图像,有点旋转,以显示预览更精美.但我的问题是,当我旋转图像时,其中一些落在AbstractNote区域之外,我找不到一个很好的方法来显示它.
我尝试使用View.setAnimation(...)它并且它有效,但给我粗糙的图像和文本,我已经尝试创建一个自定义Drawable(设置为AbstractNote.setBackgroundDrawable(...)),给我流畅的图像,但不显示完整的图像.
请注意,我的目标android是2.1,我不使用 View.setRotation(...)
使用a View.setAnimation执行此操作但获得粗糙的图像和文本

使用自定义drawable,但不能在单元格外部绘制.

如果有人知道如何修复它,通过修复尝试1中的粗糙图像和文本或如何在尝试2中在单元格外绘制图像,我将非常感激.
我有这个代码来创建菜单:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.tip_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MNU_PREV:
animateTextViewsPrev();
break;
case MNU_NEXT:
animateTextViewsNext();
break;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
和XML:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/prev_tip" android:title="@string/prevTip"></item>
<item android:id="@+id/next_tip" android:title="@string/nextTip"></item>
</menu>
Run Code Online (Sandbox Code Playgroud)
在具有Android 2.1的智能手机中,菜单是可见的,但在其他移动设备中,4.1.1是不可见的.有人现在该怎么解决呢?
我想创建一个HashMap,其中键是一个字符串,值是一个List.所有值都来自Mysql表.问题是我有一个HashMap,其中键是正确的,而值不是正确的,因为它被覆盖.事实上,我对所有不同的键具有相同内容的相同列表.这是代码:
public static HashMap<String,List<Table_token>> getHashMapFromTokenTable() throws SQLException, Exception{
DbAccess.initConnection();
List<Table_token> listFrom_token = new ArrayList();
HashMap<String,List<Table_token>> hMapIdPath = new HashMap<String,List<Table_token>>();
String query = "select * from token";
resultSet = getResultSetByQuery(query);
while(resultSet.next()){
String token=resultSet.getString(3);
String path=resultSet.getString(4);
String word=resultSet.getString(5);
String lemma=resultSet.getString(6);
String postag=resultSet.getString(7);
String isTerminal=resultSet.getString(8);
Table_token t_token = new Table_token();
t_token.setIdToken(token);
t_token.setIdPath(path);
t_token.setWord(word);
t_token.setLemma(lemma);
t_token.setPosTag(postag);
t_token.setIsTerminal(isTerminal);
listFrom_token.add(t_token);
System.out.println("path "+path+" path2: "+token);
int row = resultSet.getRow();
if(resultSet.next()){
if((resultSet.getString(4).compareTo(path)!=0)){
hMapIdPath.put(path, listFrom_token);
listFrom_token.clear();
}
resultSet.absolute(row);
}
if(resultSet.isLast()){
hMapIdPath.put(path, listFrom_token);
listFrom_token.clear();
}
}
DbAccess.closeConnection();
return hMapIdPath;
} …Run Code Online (Sandbox Code Playgroud) android ×3
android-menu ×1
android-xml ×1
canvas ×1
gridview ×1
hashmap ×1
java ×1
mysql ×1
overwrite ×1